Terminal 101: Changing the Screenshot Capture Location

Every Monday, we'll show you how to do something new and simple with Apple's built-in command line application. You don't need any fancy software, or a knowledge of coding to do any of these. All you need is a keyboard to type 'em out!

Last week, we covered how to change the format of screenshots captured by the built-in OS X screen capture utility. This week, we want to tackle the way screenshots are saved, specifically taking a look at where they're saved. By default, OS X saves these screen captures to your Desktop on OS X. We'll take a look at how to change this location to something more appropriate using a simple Terminal command. Let's get started.

Changing the Screenshot Capture Location

To change the screenshot capture location to a new place on your Mac, first think of a location that would serve you properly. We like to place ours in a "Screenshot" folder located inside of the User's "Pictures" folder. To change the location to this new location, open the Terminal and enter the following command:

defaults write com.apple.screencapture location /Users/[u]/Pictures/Screenshots/

Replace "[u]" with the name of the user on your system. Once you have entered this command, let's restart the screen capture utility by restarting the SystemUIServer by entering the following command:

killall SystemUIServer

You can optionally log out and back in instead of entering this second command, thus restarting the SystemUIServer. Once restarted, all screen captures taken from here on out will end up in your /Pictures/Screenshots/ folder in the User's home folder on your Mac.

Reverting the Capture Location back to the Desktop

So, you're tired of the new screenshot location and want to change it back to the way it was? No problem! Simply enter the following command to revert the screenshots to appearing on the Desktop when captured again:

defaults write com.apple.screencapture location /Users/[u]/Desktop/

Replace "[u]" with the name of the user on your system. Next, log out and back in to make the change, or enter the following command to restart the SystemUIServer:

killall SystemUIServer

After doing that, all new screenshots will begin appearing on the Desktop once again. Note that when entering the location path, you must specify the path beginning from the root of your Mac's hard drive. Using the " /" for specifying the user's home directory will not work. You can optionally drag and drop the folder into the Terminal window to enter the path automatically (this is a foolproof method). Also note that the location directory must have already been created, or else you will receive a permission warning from OS X.

Cory Bohon is a freelance technology writer, indie Mac and iOS developer, and amateur photographer. Follow this article's author on Twitter.