Want to automate or script taking screenshots on a Mac? Need to take a screenshot but don’t want to use the usual keyboard shortcuts and the screenshot app? Wondering whether you can make screenshots from the command line? Find out here how to take a screenshot from Mac Terminal using “screencapture” ⤓.
First, a Leiden Jar Discharges
Wilhelm Eduard Weber and Rudolf Kohlrausch, both physicists, discharged Leiden jars (electrostatic energy from early batteries) in 1856. When they measured the same current produced with electrodynamic energy (probably from a dynamo), they found a fixed ratio, and they called it ‘C’.
Weber’s constant C became a different (but naturally and importantly related) number, lost its upper case, and you know it today as c, the speed of light.
Now, I’m afraid the question why C and c are called C and c will have to wait for another time. Let’s turn to c, for now, the command line and compare times capturing screenshots with it and using a Mac’s graphical user interface:
How to Take a Screenshot from Mac Terminal Using Screencapture
Part of the Screen or a Window
Time needed: 3 minutes
To take a screenshot of a Mac’s full screen, window or selection from a Terminal command prompt using “screencapture”:
- Type
screencapture -iPin Terminal.Here’s what you get: This will begin taking a screenshot in interactive mode (
-i), which lets you choose a region or window to capture and opens the screenshot in Preview for saving or copying (-p).
It doesn’t have to be that way: See below for other ways you can use screencapture. - Press Enter.
“Screen Recording”: macOS will alert you to Terminal’s missing credentials if it is not set up to access screen and audio for recording; see below for adding that permission.
- Use the mouse to pick the region of the screen you want to capture.
Window: Press Space and click a window to take a screenshot of that window.
- Save the screenshot from Preview.
As you like it: Preview lets you save in many an image file format.
Their word: You can find information on screencapture in its man page.
Captured green text on black — and beyond?
Tips help fuel these email and tech how-tos.
The Full Screen (With or Without Delay)
To capture the whole screen using screencapture in Terminal:
- Type
screencapture <filename>to capture the full screen immediately. - Use
screencapture -T <seconds> <filename>to take a screenshot after a delay of <seconds> seconds.
Filename: Replace<filename>with the name of the file where you’s like to save the screenshot (including a file extension); you can also use-Pto open the screenshot in Preview, of course, or copy it to the clipboard (see below).
Allow Screencapture to Access the Screen
To allow Terminal (and screencapture) to record the screen on a Mac:
- Open System Settings.
- Go to the Privacy & Security category.
- Select Screen & System Audio Recording.
- Enable Terminal under Screen Recording & System Audio.
No “Terminal”: If the Terminal app is not in the list, click + and open Terminal in the /Applications/Utilities folder.
Take a Mac Screenshot without Drop Shadow
To make a screenshot of a window on a Mac without including the drop shadow:
- Run screencapture -ioP in Terminal.
Here’s why: The-ooption makes screencapture take screenshots without including shadows.
Options: You can combine-owith other options, of course, to save directly to a file, for example; see below. - Press Space.
- Click the window you want to capture as a screenshot without shadow.
- Save the image as desired from Preview.
More Screencapture Options for Taking Screenshots from Mac Terminal
Use the following general options:
- Copy the screenshot to the clipboard.
-c - Include the mouse cursor in the screenshot for full-screen pictures.
-C - Capture windows without their drop shadow.
-o - Choose the screen to capture,
1for the primary screen,2for the secondary etc.:-D <screen number> - Choose the file format for the screenshot between
jpg,pdf,tiff,heicorpng(the default).-t <format>
How to Take a Screenshot from Mac Terminal Using Screencapture: Examples
| Command | Action |
|---|---|
screencapture ~/Downloads/screenshot.png | Save full screen to ~/Downloads/screenshot.png |
screencapture -iP | Interactive selection, screenshot opens in Preview |
screencapture -T 5 -t heic screenshot.heic | Screenshot after 5 seconds, saves to HEIC |
screencapture -ic | Interactive selection, copy to clipboard |
screencapture -C screenshot.png | Include cursor in screenshot |
screencapture -o window.png | Window without drop shadow |
screencapture -D 2 secondary.png | Capture secondary display |
How to Take a Screenshot from Mac Terminal Using Screencapture: FAQ
My screenshots are blank and I get the error “could not create image from rect”; what gives?
This error typically appears when Terminal and screencapture cannot access graphics data.
Do enable Terminal for Screen Recording & System Audio in System Settings; see above.
(Tested with macOS Tahoe 26.0–26.5, Sequoia 15.1–15.4 and Sonoma 14.2–14.5; first published January 2024, last updated May 2026)