This is a website by Willem van Zyl

I'm a project manager, software developer, Apple evangelist and geek from South Africa. I'm passionate about web and mobile application development, usability, productivity, physics, astronomy, science fiction and fantasy.

If you would like to contact me, message me on Twitter or send me an email.

How to take screenshots from the command line on Mac OS X

05 Feb 2009

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 -c

Capture 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

This option isn't available in Mac OS X 10.4.* (Tiger), on that version of OS X you should rather use the command line "sleep" utility:

sleep 10; screencapture ~/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 screencapture

Keep 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
Do you like this? Share it:

Copyright © Geekology 2011. All Rights Reserved.

Hosted by Code. Like. Clockwork.