I'd like my screen shots to only be named with the current date time, preferably in a format like:


How should I go about doing this?

So far I've tried inserting an empty string into com.apple.screencapture name

as shown:

$ defaults write com.apple.screencapture name ""
$ killall SystemUIServer

But OSX is still inserting a space as shown below: enter image description here

So there's two problems I'm having:

  1. How do I change the date time format so there are no spaces?
  2. How do I make sure there is no leading space in the screenshot filename?

Thanks :)

  • 2
    Did you ever find a way to achieve that ? – cyber8200 Nov 30 '17 at 0:19

You neither can rename a file to the proposed name - it contains several colons (:) which are reserved (= forbidden) characters in the HFS+ file system - nor does defaults write com.apple.screencapture ... allow a different date format.

One idea though is creating a launch agent to rename all files in a dedicated folder starting with "Screen Shot ...":

A very simple solution, assuming you restore the default naming convention for screenshots and replace user_name by your short name below, is then:

Create a file named "screencaprn" in e.g /usr/local/bin with the content:


mv /Users/user_name/Desktop/Screen\ Shot*.png /Users/user_name/Desktop/"`date "+%Y-%m-%d-%H.%M.%S"`.png"; $2>/dev/null

Change permissions:

chmod +x /usr/local/bin/screencaprn

Then create a launch agent in ~/Library/LaunchAgents with the name "usr.screenshot.rename.plist" and the content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

Then load the plist with:

launchctl load ~/Library/LaunchAgents/usr.screenshot.rename.plist

This works but has a delay of up to 10 seconds (thus changes the seconds and sometimes the minutes of the original named screenshot file e.g. Screen Shot 2016-09-03 at 03.24.02.png to 2016-09-03-03.24.05.png) and adds one com.apple.xpc.launchd[1] (usr.screenshot.rename): Service only ran for X seconds. Pushing respawn out by Y seconds. line to the system log.

| improve this answer | |
  • Note on the : character: Actually it is not a reserved or special character on the HFS+ filesystem, and you can use it perfectly well in a filename. However it will look like a / in Finder due to a throwback from conversion from Classic Mac OS (which allowed the / character in filenames, but not :) to OS X (which does not allow /, but does allow :). – 0942v8653 Sep 3 '16 at 3:06
  • Great answer! Works like a charm. There's only a 1-2 second delay for me. – Chris Geirman Sep 8 at 22:06

j̶u̶s̶t̶ ̶u̶s̶e̶ ̶2̶ ̶c̶o̶m̶m̶a̶n̶d̶s̶:̶ ̶

d̶e̶f̶a̶u̶l̶t̶s̶ ̶w̶r̶i̶t̶e̶ ̶c̶o̶m̶.̶a̶p̶p̶l̶e̶.̶s̶c̶r̶e̶e̶n̶c̶a̶p̶t̶u̶r̶e̶ ̶n̶a̶m̶e̶ ̶"̶$̶(̶d̶a̶t̶e̶ ̶+̶%̶Y̶-̶%̶m̶-̶%̶d̶)̶ ̶$̶(̶d̶a̶t̶e̶ ̶+̶%̶H̶-̶%̶M̶-̶%̶S̶)̶"̶ 
defaults write com.apple.screencapture "include-date" 0

Please note that you can't use the : in filenames on macos.

I̶ ̶u̶s̶e̶ ̶2̶ ̶d̶a̶t̶e̶ ̶v̶a̶r̶i̶a̶b̶l̶e̶s̶ ̶t̶o̶ ̶a̶c̶h̶i̶e̶v̶e̶ ̶t̶h̶i̶s̶ ̶t̶e̶m̶p̶l̶a̶t̶e̶:̶ ̶̶2̶0̶1̶9̶-̶0̶7̶-̶0̶2̶ ̶2̶3̶-̶0̶4̶-̶0̶4̶.̶p̶n̶g̶̶

you can also change the default screenshot location (in my case this is a folder in iCloud)

defaults write com.apple.screencapture location "~/Library/Mobile\ Documents/com\~apple\~CloudDocs/screenshots"

UPD: its not correct solution. the name will be the same for each screenshot, and generated date - its the date when you run these command

| improve this answer | |
  • You can also try this instead if you don't want the date to appear: defaults write com.apple.screencapture include-date -bool false; killall SystemUIServer – Sun Aug 31 at 5:17

The time format is based on what you have in:
System Preferences > Language & Region > 24-Hour Time

It can be overridden by changing the format in:
System Preferences > Language & Region > Advanced... > Times > Medium

There is an odd bug in Finder when renaming screenshots that do not have the AM/PM in the filename, as the periods separating the time are confused with the one separating the file extensions.

To get rid of the Screen shot and leading space, I'd use a tool that watches the filesystem and can carry out user-defined actions — something like Hazel. In fact, you could not mess with System Preferences at all and just get Hazel to rename the screen shot files for you.

Note: you won't be able to use the : colon character in filenames.

| improve this answer | |

See How do I change the default screenshot name in OS X Lion? for changing the rest of the name. The space is inserted by the string format indicated in the strings file, most likely due to the need for localization of date and time values. If you combine changing the plist name prefix with changing the formatted tinestamp you can make it do whatever you like.

| improve this answer | |

Another solution is a long-running daemon that subscribes to the file modification service and changes the filenames when they are created.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .