brew install opencv cmake ffmpeg@4
For installing OpenCV, I suggest to follow https://gocv.io/getting-started/linux/ tutorial; it has build commands for building OpenCV with CUDA support as well.
cd ./cmd/ml && ./download_data_v4.sh
cd ./cmd/ml && go build .
./ml --settings=config.json
Change "source" in config.json to "webcam". Don't forget to check "device_id" value in "video_capture_device" object.