17

Is there a way to change the default screenshot filename prefix (the Cmd-Shift-4 type screenshot) to something other than the default? The default name looks like this:

Screen Shot 2011-08-30 at 10.01.36 AM.png

But I'd prefer to use something like:

screenshot_2011-08-30_100136.png

Basically so I can remove the spaces and junk, since it's annoying to browse dig through files in Terminal. Any easy way to change this prefix with one of the defaults write com.apple.screencapture style commands?

2
  • 2
    Is there any chance we could get you to select an answer that worked for you? (or an edit to know better what you seek?)
    – bmike
    Commented Apr 13, 2013 at 14:43
  • Similar Info: superuser.com/q/339702/247728
    – JayRizzo
    Commented Jan 31, 2019 at 23:55

8 Answers 8

12

You can change 'Screen shot' to 'screenshot' with the following commands

defaults write com.apple.screencapture name screenshot
killall SystemUIServer

If you want to go digging a bit deeper in Terminal, you can achieve what you want by doing the following:

NOTE: Make a backup of any files you change in case you make a mistake.

  1. cd /System/Library/CoreServices/SystemUIServer.app/Contents/Resources/English.lproj
  2. Make a copy of the existing file:
    sudo cp ScreenCapture.strings ScreenCapture.strings.old
  3. Enter Admin password if prompted
  4. Convert to an editable format:
    sudo plutil -convert xml1 ScreenCapture.strings
  5. sudo vi ScreenCapture.strings

    Locate the following lines:

    <key>%@ %@ at %@</key>  
    <string>%@ %@ at %@</string>  
    

    and replace with the following lines:

    <key>%@ %@ at %@</key>  
    <string>%@_%@_%@</string>  
    
  6. Convert back to binary:
    sudo plutil -convert binary1 ScreenCapture.strings
  7. killall SystemUIServer

which combined with the first change should get you something like this:

screenshot_2011-08-30_10.01.36.png which is very close to what you need I think

1
  • 4
    This does not appear to work in OS X El Capitan, presumably due to System Integrity Protection. Commented May 19, 2016 at 21:22
7

I solved this another way. Using Automator I set up a Folder Action to monitor my screen shot folder and rename any new files exactly the way I want them.

There's a decent guide here with a similar approach and instructions.

3
  • What's the latency with the Automator approach? How long between the time the original screencap is saved, and the file is available with the new filename? Is it 1 second, 3 seconds, 12 seconds?
    – Cheeso
    Commented Dec 4, 2013 at 2:23
  • Between 5 and 7 seconds from screenshot is taken until the file name is changed (on my MacBook Pro from 2009).
    – Adrian B
    Commented Dec 4, 2013 at 7:43
  • Thanks! Given that, I'm going to write some bash code to do this.
    – Cheeso
    Commented Dec 4, 2013 at 18:13
4

I have disabled the default shortcuts and assigned a shortcut to this command:

screencapture -i ~/Desktop/$(date +%Y%m%d%H%M%S).png

-i (interactive) is like ⇧⌘4 or ⌃⇧⌘4.

2
  • That seems like the most direct solution to the problem. But how does one map a shortcut to a command? In the System Preferences dialog, it says "enter the exact name of the MENU COMMAND you want to add." Your command is not a menu command, so...?
    – Cheeso
    Commented Dec 4, 2013 at 2:35
  • 1
    @Cheeso See the link in the answer. You can use an application like FastScripts or Alfred or create a service with Automator.
    – Lri
    Commented Dec 4, 2013 at 4:23
3

Open terminal and enter:

$ sudo su

$ cd /System/Library/CoreServices/SystemUIServer.app/Contents/Resources/English.lproj

$ plutil -convert xml1 ScreenCapture.strings

$ nano ScreenCapture.strings

change

<key>%@ %@ at %@</key>
    <string>%@ %@ at %@</string>
<key>.</key>
    <string>.</string>
<key>Screen Shot</key>
    <string>Screen Shot</string>

to

<key>%@ %@ at %@</key>
    <string>%@_%@_%@</string>
<key>.</key>
    <string></string>
<key>Screen Shot</key>
    <string>screenshot</string>

then

Control + O to write the file, and Control + X to exit nano

$ plutil -convert binary1 ScreenCapture.strings

$ killall SystemUIServer

One more thing to note here is that to get rid of AM/PM you will need to change it in System Preferences > Language & Text > Formats (24 hour format). Time stamps are displayed according to how this is set; keep in mind if you change this setting all filenames will use this format.

~ Let me know how it works out.

3

The same effect of the complicated terminal actions shown above can be achieved through the free secrets preference pane, which serves as an interface for all sorts of hidden setting in Mac OS and it's apps. Simply open the pref pane and find the setting u want to change

1

IMO you should absolutely not muck around with anything in /System/.

For one thing, you are just asking for your customizations to be overwritten by a future update.

Download the demo of Sharpshooter from http://www.kerlmax.com/products/sharpshooter/

You can use it for 30 days. Then buy it for $15. It's a great utility.

Alternatively, have you tried Skitch? It's completely free, and a lot better than the built-in.

1

I liked Adrian B's answer. Here's the shell script I wrote to rename screen cap files: https://gist.github.com/DinoChiesa/7796444

To set it up as a Folder Action, follow this article.

When you get to the Automator window, follow this guide:

enter image description here

Don't forget to save it (Command-S).

It takes 3-6 seconds, in my experience, for that folder action to "kick off" after I capture the screen.

1

just use 2 commands:

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̶ ̶"̶s̶c̶r̶e̶e̶n̶s̶h̶o̶t̶_̶$̶(̶d̶a̶t̶e̶ ̶+̶%̶Y̶_̶%̶m̶_̶%̶d̶-̶%̶H̶_̶%̶M̶_̶%̶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̶ ̶"̶i̶n̶c̶l̶u̶d̶e̶-̶d̶a̶t̶e̶"̶ ̶0̶

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"
2
  • This worked the first time, but every subsequent screenshot just repeated the first name and appended an incremented number to the end. Commented Feb 11, 2020 at 0:44
  • @BrettVanderVeen yes you're right, it's not a solution Commented Feb 11, 2020 at 16:49

You must log in to answer this question.

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