10 of the Best Defaults Write Commands to Improve Mac OS X

Oct 9, 2012 - 29 Comments

defaults write commands in Mac OS X

Most Mac OS X preferences are managed through easily accessible control panels, but going behind the scenes with defaults write commands can lead to some genuinely useful tweaks that can only be made through the command line. This list represents a compilation of some of the best defaults write commands out there, and even if you’re not an advanced user you’ll find some of these tricks to be well worth your while.

10 Best defaults write Commands for Improving Mac OS

To get started, launch Terminal from Spotlight or the /Applications/Utilities/ directory and just copy and paste the string into the command line.

Mac Terminal icon

Remember, all defaults write commands belong on the same line when executed, and many of these will automatically restart a service, like the Dock, when used.

Remove the Auto-Hide Dock Delay

For those of us who hide our Docks, there is a very short delay when going to the bottom of the screen to reveal it. It may not be too noticeable at first, but removing the Dock delay makes that delay obvious, resulting in your Mac actually feeling faster.

defaults write com.apple.Dock autohide-delay -float 0 && killall Dock

Speed Up Mission Control Animations

This is another tip that makes your Mac feel faster, just by reducing the length of Mission Control animation speeds.

defaults write com.apple.dock expose-animation-duration -float 0.12 && killall Dock

Make Hidden App Icons Translucent in the Dock

Hiding open apps has long been a useful feature of Mac OS, but by default there’s no easy way to tell what’s hidden and what’s not. Thankfully, a simple command enables translucency for hidden apps, making them easy to tell apart from the rest:

defaults write com.apple.Dock showhidden -bool YES && killall Dock

Stop Full Names from Copying with Email Addresses in Mac OS X Mail

For whatever reason when you copy an email address in Mac OS X Mail app, the persons full name gets attached along with it. This means when you go to paste you get the persons name with the email rather than just the email address. Annoying, but this can be turned off with a defaults write command:

defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false

Enable Text Selection in Quick Look Windows

Quick Look is one of the most useful aspects of Mac OS X, and being able to select text from the windows seems like a no brainer, so here’s how to enable it:

defaults write com.apple.finder QLEnableTextSelection -bool TRUE;killall Finder

Always Show Hidden Files in the Finder

Hidden files are, unsurprisingly, hidden by default in the Mac OS X Finder. This is easy to change to always have hidden files visible, though it’s probably most applicable to advanced users.

defaults write com.apple.finder AppleShowAllFiles -bool YES && killall Finder

Hide Desktop Icons Completely

If your desktop quickly ends up as a clutter of files on top of files, hiding all icons from the desktop provides instant relief and makes for a minimalist onscreen experience. The files are still accessible through the Finder in the Desktop folder, you just won’t see them covering your wallpaper all the time.

defaults write com.apple.finder CreateDesktop -bool false && killall Finder

Show System Info at the Login Screen

With this enabled, you can see some basic system info from the login screen, including MacOS X system version, hostname, and more, by clicking the clock at the login window. Most useful for sysadmins and power users.

sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName

Change Where Screen Shots Are Saved To

If you take a lot of screenshots you know how fast your desktop gets littered with them. The best solution is to create a new folder in /Pictures/ or ~/Documents/ and then set that to the new default screen shot save location with a defaults write command:

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

Change the Default Screen Shot Image Type

Speaking of screen shots, you can change the default file type from PNG to JPG or a variety of other options with a defaults write command. JPG offers the best file size and compression while still looking decent:

defaults write com.apple.screencapture type jpg && killall SystemUIServer

Bonus: Always Show the User Library Folder

A simple command lets the user ~/Library always be shown. This isn’t a defaults write command but it’s very useful if you frequently dig around in that directory, and you may as well make the change while you’re in the terminal.

chflags nohidden ~/Library/

Most of these commands will be usable in all versions of Mac OS X, though obviously things that require something like Mission Control is only going to work in later MacOS versions that support those features.

Did we miss any essential defaults write commands? Let us know in the comments.

.

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS, Tips & Tricks

29 Comments

» Comments RSS Feed

  1. sam Johnson says:

    I had problems with the quicklook hack until I realised that, in order to select the text I had to double-click first then I was able to drag to highlight it and then copy and paste it. just a tip

  2. Shreyas says:

    Hey Guys,
    Really cool tricks.
    I hope someones still online here, I need help with disabling Pop-Ups in safari.
    I want to do it through the terminal and not by opening Safari.
    Is there a way to do this using defaults write?

    Thanks

  3. mystery says:

    On case-sensitive systems, you’ll need to use lower-case ‘dock’

  4. Wiley B says:

    Hey, great thread!

    Quick question re “Remove the Auto-Hide Dock Delay”. I’ve just done this but don’t like the speed. What’s the original float speed? For example, the command set it to 0.12, what would the command/speed setting be to revert it back to what it was before?

    Thanks guys!

  5. Harry N says:

    Great thread!!!

    Does anyone know if there’s a tweak to change the “To:” field in Mac Mail’s Inbox in 10.8 back from gray to black ?? It doesn’t bother myself but it does a client of mine.

    thanks
    H

  6. Ravi Chivukula says:

    Is there a defaults command for mail.app to to set a default Reply-To and From header fields for all outgoing email from a specific mail account (and NOT from ALL mail accounts) ?

    For example, I have mail accounts M1 and M2 that use the same Gmail (IMAP or Pop) account.

    However, when I use M1 to send emails, I want the Reply-to and From header fields to always be that of the Gmail account.

    And, when I use M2 to send emails, I want the Reply-to and From header fields to always be something different from the Gmail account. I need this because I have a grad school forwarding email address that I forward to my Gmail account. When I send emails from this account, I want reciepients to see I am using the grad-school email address.

    Is this possible? I am using Mac OS X Mountain Lion 10.8.3 and Apple Mail 6.3.

    Thanks for reading and even trying to help!!

  7. me says:

    1
    how do you get the current setting ( before messing things up )

    2
    how to make an alias (or shellscript or whatever) so that a complex command line (okay they can be copypasted) can be a one-line deal.

    3
    how to make an alias for undoing what you just did. “undo” (one step undo maybe).

    why is all of this so wrongheaded? are we in the wrong world? is there a secret use for all this crap? here we are in 2013 and computers are a huge WOT.

  8. voji91 says:

    “Bonus: Always Show the User Library Folder” is awesome :)

  9. Robin says:

    If you see you’re running low on RAM, there is a great free app from the MAc App Store to deal with this. FreeMemory does just what it says on the tin.

  10. iGnome says:

    Interesting article which would be even better if you gave the way to revert each tweak, I’d be nervous of making changes that I felt I didn’t know how to reverse.

  11. Nick says:

    how to undo the hidden files

  12. Rich W. says:

    FYI — If you’re interested in more customization, TinkerTool is a lightweight app that provides a System-Prefs-style interface to make changes to some basic defaults like these. While it doesn’t do everything in this top ten list, it does perform a few, and it’s worth checking out for the other modifications it offers.

  13. Atthead says:

    Not being too much experienced with MacOS, what if I enter a command that actually does not work for my version of OSX? Somebody just have reported the show OS info command not to work under 10.8.2, can I do any harm with a wrong command given?
    thx

  14. Jonathan says:

    How do you revert show hidden files?

    • Dimon says:

      defaults write com.apple.finder AppleShowAllFiles -bool NO && killall Finder

      always change yes to no, true to false, 1 to 0, etc.

  15. Amer says:

    Thanks for the great tips but it useful when listing such commands to list as well the reverse action should someone need to undo or back to early/original state.

  16. Dom says:

    This is a great list of tricks! Thanks! Thanks also Lauri for the expanded QuickLook trick.

    The “show system info at login screen” trick doesn’t work for me though. I’m using 10.8.2.

  17. media_lush says:

    anybody know the command that removes the shadow from screenshots that works for Mountain Lion?…. the old code doesn’t.

    Also “purge” now works properly with the ML update.

    don’t forget:

    kill all Finder

    to get coloured or custom folders back in the sidebar

  18. hector says:

    How to revert the hiding of the desktop icons?

  19. Lauri Ranta says:

    defaults write -g QLEnableTextSelection -bool true would also apply to other applications.

    Some of my favorites that haven’t been mentioned in many places yet:

    # don’t blink the caret (the value is in milliseconds)
    defaults write -g NSTextInsertionPointBlinkPeriod -int 9999999999999999

    # use a lighter text rendering style
    defaults write -g AppleFontSmoothing -int 1
    sudo defaults write -g AppleFontSmoothing -int 1

    # disable the animations for opening Quick Look windows
    defaults write -g QLPanelAnimationDuration -float 0

    # display ASCII control characters in caret notation
    defaults write -g NSTextShowsControlCharacters -bool true

    # disable checking spelling while typing
    defaults write -g NSAllowContinuousSpellChecking -bool false

    # disable auto-save in AppleScript Editor
    defaults write com.apple.ScriptEditor2 ApplePersistence -bool false

  20. js says:

    Great list of tricks guys thanks

  21. Robert D. says:

    The “chflags nohidden ~/Library/” setting is not permanent. Each time there is an OSX update, you will have to reenter this command. Is this also true for the other examples that were shown?

    • Quaid says:

      All defaults commands are permanent until you reverse them with another defaults command. Usually a ‘defaults delete’ does the trick.

      • baltwo says:

        Not true for this one, since each update resets the flag. Note, that in some instances a restart is needed to make this work. I’ve not found why sometimes it takes effect immediately, but not others.

        • DeusExMachina says:

          Um, yes it is.
          “chflags” is not a defaults command, so its behavior has no bearing on the claim that all defaults commands are permanent.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site