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

Oct 9, 2012 - 23 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.

To get started, launch Terminal from the /Applications/Utilities/ directory and just copy and paste the string into the command line. 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 OS X Mail

For whatever reason when you copy an email address in 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 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 OS 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 OS X, though obviously things that require something like Mission Control is only going to work in Lion, Mountain Lion, and onward.

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

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

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

23 Comments

» Comments RSS Feed

  1. 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.

  2. js says:

    Great list of tricks guys thanks

  3. 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

  4. hector says:

    How to revert the hiding of the desktop icons?

  5. 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

  6. 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.

  7. 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.

  8. 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.

  9. 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

  10. 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.

  11. Nick says:

    how to undo the hidden files

  12. 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.

  13. 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.

  14. voji91 says:

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

  15. 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.

  16. 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!!

  17. 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

  18. 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!

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

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