Terminal – Add Access to MacBook Camera for Terminal Application

cameraterminal

I am trying to run a OpenCV tutorial that uses the cv.VideoCapture(0). This does require permission from terminal to access the camera. Here is a blog description showing that they see the terminal app included in the Applications list:

enter image description here

But for me the Terminal is not provided as an optional App:

enter image description here

That is actually not at all surprising. But then how to add Terminal? The apple docs only show this: https://support.apple.com/guide/mac-help/control-access-to-your-camera-on-mac-mchlf6d108da/mac :

enter image description here

No mention of how to add other apps is included. So how to add Terminal? (Actually I would also be interested in adding for iTerm2 ..)

Best Answer

You can force your terminal to request access to your Camera.

I used the following commands (these are meant to click a picture from your MacBook's camera):

ffmpeg -f avfoundation -list_devices true -i ""

List the devices attached to your computer. Get the device ID of your camera


ffmpeg -ss 0.5 -f avfoundation -i "0" -t 1 capture.jpg

Capture the photo.


Although this did not click a picture (returned an error), but it did force the terminal to ask permission to access the Camera.

P.S: You need to have the ffmpeg package installed. You can do brew install ffmpeg

I got these commands from this stackoverflow answer

Update by Question Asker This does work and here is the screenshot

enter image description here