
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 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
Have Questions? Post them here!
- How to find path of file on Mac Terminal
- How to disable Siri on Mac Monterey
- [fix] macOS Ventura xcrun: error: invalid active developer path missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
- Select Line Number TextEdit on Mac
- Go to Specific file path using Mac Finder
- How to find Java HOME in Mac Terminal
- bash: command not found error [macOS Terminal Linux, Unix or Windows]
- Must Know Homebrew Commands for Mac/Linux Users
- How to Insert an Inverted Question Mark on Mac ¿
- Hide Keyboard Text Input Icon on macOS Ventura Menu Bar
- How to make macOS Terminal window Transparent (or Opaque)
- How to check of Updates on Microsoft Edge Browser on Mac (macOS)
- Limit scrollback rows in macOS Terminal
- How to identify installed Java (JDK) Version on macOS
- Keyboard Shortcut to delete a file on a Mac [Macbook]
- Open Docker from Terminal Command on Mac
- Installing MongoDB on Linux/Unix/macOS/Ubuntu
- How to take a screenshot on a Mac - updated for Ventura 13 [updated 2023]
- ls: .: Operation not permitted - Mac Terminal ZSH Error
- How to remove username from Mac Menu Bar?
- macOS Ventura XCode Command Line Tools Installation
- Where is .zshrc file located in macOS
- How to Show Path of Files or App in Mac Spotlight Search
- How to enable root user on Mac Terminal
- Install Java 17 (LTS) JDK on ARM based M1/M2 Mac Natively
- [Solved] SharePoint Search Internal server error exception - SharePoint
- What is the doctype for HTML5? - Html
- Setting $JAVA_HOME Environment Variable in macOS - MacOS
- -bash: startup.sh: command not found - Apache Tomcat 8 - Tomcat
- PowerShell - How to use Try Catch Finally blocks for error exception handling (Windows/SharePoint) - SharePoint
- How to reset eclipse layout - Android
- Hide cURL Outputs and Errors on Terminal - cURL
- Convert String to int in Java - Java