
If you have a use-case where in you want to capture an image (photo) using the Macbook webcam using a Terminal Command, well you can do so easily by using a tool called imagesnap
You can install the imagesnap package using brew,
% brew install imagesnap
Usage Example:
Once installed, open the Mac Terminal App and simply type imagesnap on the shell prompt when ready to capture an image,
% imagesnap
Capturing image from device "FaceTime HD Camera"...snapshot.jpg
For the first use you will be asked - "Terminal.app" would like to access the camera. say OK

The image you captured will be saved as snapshot.jpg to the current location you are in (pwd)
To save the image with a custom image name, pass in an argument with the file-name.jpg
Example:% imagesnap mike-2023-01-23.jpg
If you have multiple camera devices attached to your device, make use of the -l option to list them,
% imagesnap -l
Video Devices:
=> FaceTime HD Camera (Built-in)
=> USB 3.0 Camera
=> bitCam
You can set the custom camera to click a photo using the -d option followed by the device name,
Example:% imagesnap -d bitCam
Check out the help to know more,
% imagesnap -h
USAGE: imagesnap [options] [filename]
Version: 0.2.15
Captures an image from a video device and saves it in a file.
If no device is specified, the system default will be used.
If no filename is specfied, snapshot.jpg will be used.
JPEG is the only supported output type.
-h This help message
-v Verbose mode
-l List available video devices
-t x.xx Take a picture every x.xx seconds
-n num Limit to <num> snapshots in -t timelapse mode
-q Quiet mode. Do not output any text
-w x.xx Warmup. Delay snapshot x.xx seconds after turning on the camera (default 3sec)
-d device Use named video device
Github Page: https://github.com/rharder/imagesnap
You can easily use this package in a Python Script to fit in a use-case such as
- Take class attendance using photo capture and face recognition.
- Take a photo after submitting an application form.
- Take photo before a git commit
Facing issues? Have Questions? Post them here! I am happy to answer!
- How to Display Analog Clock on Mac Menu Bar
- Shutdown Mac Terminal Command
- How to know the Serial Number of MacBook on macOS Ventura 13.0
- macOS: Remove Desktop or Documents Folder from iCloud Drive Syncing
- [fix] How to Show file extensions on all files on Mac
- How to install Zoom Add-in to Outlook (Mac)
- How to turn off Stage Manager - macOS Ventura
- Fix - Xode - Internal logic error: Connection was invalidated
- How to do calculations in Mac Terminal
- How to delete a Page in Microsoft Word File on Mac (macOS)
- How to Refresh Mac Desktop
- How to install Java on macOS [Big Sur]
- How to Disable Mac Terminal Bell Sound
- Installing MongoDB on Linux/Unix/macOS/Ubuntu
- How to Uninstall Brew on Mac
- Find your macOS version
- Change TextEdit File Encoding
- AppleScript Example with TextEdit
- How to install homebrew (brew) on M1 Mac
- How to Find File and Directory Size in Mac Terminal
- How to open new tab in Sublime Text Editor [macOS]
- How to list all users in Mac Terminal
- Turn off Auto-Capitalization on macOS Ventura 13
- How to check Command Line Tools Version [Updated for Ventura]
- Change Current User Password using Mac Terminal Command
- How to SFTP to port different than 22 (SFTP Custom port) - FTP
- How to comment out a block of code in Python - Python
- Setting up Zsh Syntax Highlighting - zsh
- Move from Zsh to Bash shell macOS - MacOS
- The Quick Analysis Tool in Excel for Mac? - MacOS
- Error: Failed to validate the signature of the actionable message card - Power Automate Flow - PowerAutomate
- How to Update Safari on Mac to the Latest Version [macOS] - MacOS
- Gmail Unable to upload because it is a folder or a package (like an application bundle or RTFD document) - HowTos