Skip to Content

Terminal Tip: 6 easy ways to capture your screen

OS X's built in screencapture command provides a simple command-line utility to snap images of your desktop. It offers quite a few options and many of them do not quite work as advertised. Even the manual page admits that screencapture is "not very well documented to date".

To make it easier for you to jump in and get started with screencapture, here are six convenient already-tested variations that you can copy, paste and use. Consider adding these capture methods to shell scripts, to system calls from AppleScript or just running them directly from the command line as needed.

1. Capture your primary screen as a (default) png file.
% screencapture ~/Desktop/screencap.png

2. Capture your primary screen as a jpeg (-tjpeg), including the cursor (-C)
% screencapture -C -tjpeg ~/Desktop/mycapture.jpg

3. Wait for five seconds before capturing the screen.
% sleep 5; say "ready"; screencapture ~/Desktop/mycapture.png

4. Interactively (-i) select (-s) an area of your screen with the mouse.
% screencapture -i -s -tjpeg ~/Desktop/mycapture.jpg

5. Interactively (-i) select a window with the mouse. When the crosshairs appear after issuing this command, press the space bar then select a window with the camera.
% screencapture -i -tjpeg ~/Desktop/mywindow.jpg

6. Select an area of your screen and copy it to the clipboard (-c) rather than a file.
% screencapture -i -s -c



Categories

How-tos Terminal Tips

OS X's built in screencapture command provides a simple command-line utility to snap images of your desktop. It offers quite a few options...
 

Add a Comment

*0 / 3000 Character Maximum

10 Comments

Filter by:
Cary

Can I capture a window with a clean shadow? I mean, only the transparent shadow itself, but NOT the background content under the shadow. This way when I post this image on a web page with any background color, the shadow always matches nicely.

May 19 2007 at 1:10 PM Report abuse rate up rate down Reply
VanillaSpice

james, justin - key commands aren't useful in scripting, and this command also allows you to select the output format.

May 17 2007 at 10:37 PM Report abuse rate up rate down Reply
sine nomine

Hmm, the png it created couldn't be opened by Preview or Photoshop, and it didn't like the -tjpeg option. Maybe a Jaguar thing? (Yes, I'm still using Jaguar...)

It's odd, I've been having trouble getting a screen capture lately using everything from Grab to Snap 'n Drag - everything comes out garbled and there are often features mashed in like parts of windows that aren't even open. I was kind of hoping this would be an alternative that would work, but alas no.

May 17 2007 at 2:40 PM Report abuse rate up rate down Reply
jc

ditto on the keyboard shortcuts, why even bother with anything else...you can't really simplify it much more.

May 17 2007 at 2:13 PM Report abuse rate up rate down Reply
Martin Sketchley

I use a very useful widget called Screenshot Plus. It's great.

May 17 2007 at 1:08 PM Report abuse rate up rate down Reply
James Gregory

You can do the same thing using keyboard shortcuts.

Cmd + Shift + 3 = Take screenshot of whole screen
Cmd + Shift + 4 = Draw an area to capture
Cmd + Shift + 4, then space = Capture a window.

May 17 2007 at 11:52 AM Report abuse rate up rate down Reply
Erica Sadun

Tim: The command line better lends itself to automation.

May 17 2007 at 11:48 AM Report abuse rate up rate down Reply
tim

Why not just use "Grab?" It's already designed to do this and there are no command lines necessary. I've never understood why people want to do things the more complicated/nerdy way.

May 17 2007 at 11:40 AM Report abuse rate up rate down Reply
Erica Sadun

Used option #5 to set up the screen and SnapzPro to shoot the screen shot shooting.

May 17 2007 at 11:21 AM Report abuse rate up rate down Reply
superjeff

So how did you capture THAT screen shot?

May 17 2007 at 11:20 AM Report abuse rate up rate down Reply
Buy an ad here

Hot Apps on TUAW

Tweets

© 2012 AOL Inc. All Rights Reserved.