Changing Where Screenshots are Saved on a Mac

28th April 2022 | Programming

Since the classic days of Mac OS, the Desktop has been the traditional dumping ground for a variety of files and folders. When one takes a screenshot, the Desktop is the default location where to save it, but it is possible to change where screenshots are stored. A couple of quick commands will help clean up your Desktop so it isn't populated by quite so many screenshots.

Mac Screenshots

If you have macOS Mojave (10.14) or later on your Mac, the location can be set using the Mac's built in screenshot functionality.

  1. Press Command + Shift + 5
  2. Click on Options
  3. Pick one of the listed folders or choose Other Location. For my purposes, I selected the folder Screenshots in my Pictures folder (~/Pictures/Screenshot).

However, if you are not using macOS Mojave or later, you'll need to use the Terminal. The following commands sets the Mac's default location to a folder named Screenshots in the Pictures folder:

defaults write com.apple.screencapture location ~/Pictures/Screenshots
killall SystemUIServer

To read the default setting:

defaults read com.apple.screencapture location

If the location value has not been set yet, you'll see this response:

defaults read com.apple.screencapture location
2022-04-25 11:02:26.195 defaults[6668:108767] 
The domain/default pair of (com.apple.screencapture, location) does not exist

Or check all of the com.apple.screencapture settings.

% defaults read com.apple.screencapture
{
    "last-analytics-stamp" = "672074805.851666";
    "last-selection" =     {
        Height = 945;
        Width = 433;
        X = "-1201";
        Y = 118;
    };
    "last-selection-display" = 1;
    style = selection;
    video = 1;
}

After setting the location:

% defaults read com.apple.screencapture location
~/Pictures/Screenshots
% defaults read com.apple.screencapture
{
    "last-analytics-stamp" = "672074805.851666";
    "last-selection" =     {
        Height = 945;
        Width = 433;
        X = "-1201";
        Y = 118;
    };
    "last-selection-display" = 1;
    location = "~/Pictures/Screenshots";
    "location-last" = "~/Pictures/Screenshots";
    style = selection;
    target = file;
    video = 1;
}

iOS Simulator

If you are a developer who often saves screenshots of the iOS Simulator, it also has its own setting where to save the snapshots. Changing the location where the iOS Simulator saves screenshots is fairly similar to the approach to saving macOS screenshots when using the Terminal. The Terminal command to change the default location where the iOS Simulator saves screenshots:

defaults write com.apple.iphonesimulator "ScreenShotSaveLocation" -string "~/Pictures/Screenshots"
To verify, run:
defaults read com.apple.iphonesimulator "ScreenShotSaveLocation"

This should then reveal the location where the screenshot will be saved (e.g. ~/Pictures/Screenshots). Like the Mac example, if the location hasn't been set yet, you will get a response like this:

% defaults read com.apple.iphonesimulator "ScreenShotSaveLocation"
2022-04-26 19:52:49.189 defaults[20441:18169586] 
The domain/default pair of (com.apple.iphonesimulator, ScreenShotSaveLocation) does not exist

References