Mac OS X Quick Tip – Taking screenshots from the command line
In addition to the default screenshot shortcut keys provided by Mac OS X, the built-in screencapture command line utility allows for a variety of screenshot options:
Capture the screen to the clipboard:
screencapture -cCapture a selection or window (press spacebar to switch):
screencapture -i ~/Desktop/screenshot.png
Capture a window without its shadow (press spacebar after entering the command to enable Window Selection mode):
screencapture -io ~/Desktop/screenshot.png
Capture the screen and open the image in a new Mail message:
screencapture -M ~/Desktop/screenshot.png
Capture the screen and open the image in a Preview window:
screencapture -P ~/Desktop/screenshot.png
Capture the screen and save the image in the specified format (valid values are pdf, jpg, tiff, etc.):
screencapture -t png ~/Desktop/screenshot.png
Capture the screen after the specified amount of seconds have passed:
screencapture -T 10 ~/Desktop/screenshot.png
Capture the screen without playing the camera shutter sound:
screencapture -x ~/Desktop/screenshot.png
You can see all the screencapture parameters by running:
man screencaptureKeep in mind that these parameters can be combined, so you could, for instance, take a timed screenshot without the camera shutter sound:
screencapture -T 10 -x ~/Desktop/screenshot.png
** 09/02/19 UPDATE: Thanks to nerdnotes.org for mentioning that the ‘-T’ (timed screenshot) option isn’t available in the Mac OS X 10.4.* (Tiger) version of this tool. Instead, you can use the command line sleep utility to take a timed screenshot: ’sleep 10; screencapture ~/Desktop/screenshot.png’.
Related posts:
- Taking Screenshots on the iPhone and in Mac OS X
- Mac OS X Quick Tip: Using Spotlight to search from the command line
- Changing the format of screenshots saved to your Desktop on Mac OS X
- Reusing commands with different arguments on a Bash command line
- UNIX Quick Tip: See the current UNIX Timestamp and other date formats on the command line



05 Feb 2009 








author
Trackbacks/Pingbacks
cmdline screenshots in OSX…
Geekology describes a nice osx builtin command to create screen captures: screencapture. I wanted to create a screenshot of a mouse interaction. That requires some sort of a delay after initiating the capture. The “-T” option described faci…