Add access to the macbook camera for the terminal application
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:
But for me the Terminal
is not provided as an optional App:
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 :
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
..)
Solution 1:
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