Need to take a screenshot on your Mac 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 the Mac Terminal Command Line
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 -iP
in 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.
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-P
to 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.
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 file format for the screenshot between
jpg
,pdf
,tiff
orpng
(the default).-t <format>
(How to take a screenshot from the Mac Terminal command line tested with macOS Sonoma 14.2–14.5; first published January 2024, last updated June 2024)