Set preferences, the OS X user defaults system works with both the OS and with individual applications.

      defaults [host] Actions Options

      defaults help

   read [domain [key]]      Print defaults to standard output

   read-type domain key     Print the plist type

   write domain key 'value' Save a default value

   write domain 'plist'     Save plist (a property list) as a default:

   rename domain old_key new_key  Rename a domain key.

   delete [domain [key]]    Remove key.
                            (for most applications this will return the behaviour
                             to the original default values) 
   domains                  Print all the domains in the user's defaults system.

   defaults [host] find word 
                            Search for word in the user's defaults, and
                            print a list of matches.

   Host  Optionally you can restrict changes to a specific host
         by default changes will apply to any host.
         [-host hostname] Restrict to a remote machine.
         [-currentHost]   Restrict to the host the user is currently logged into.

Options: See below

If you change a default that belongs to a running application, the application won't see the change and might even overwrite the default.

In general you should close an application before changing its defaults, in the case of Dock and Finder defaults - restart them after applying the default with the killall command : Restart the Dock: killall Dock Restart the Finder: killall Finder


Monitor font smoothing

Display the current font smoothing:
$ defaults -currentHost read -globalDomain AppleFontSmoothing

Change the font smoothing (
0=off, 1=light, 2=Medium/flat panel, 3=strong/blurred)
defaults -currentHost write -globalDomain AppleFontSmoothing -int 0
Restart applications to see the effect

Delete the setting completely (restore default)
defaults -currentHost delete -globalDomain AppleFontSmoothing

Apple Mail

Close Mail before making any changes.

Set a minimum font size of 14px (affects reading and sending email):
$ defaults write MinimumHTMLFontSize 14

Force all Mail messages to display as plain text:
defaults write PreferPlainText -bool TRUE
For rich text (the default) set it to FALSE

iTunes 10

Make the arrows next to artist & album jump to local iTunes library folders instead of Store
defaults write show-store-link-arrows -bool YES
$ defaults write invertStoreLinks -bool YES
To restore the default change the YES to NO

Restore the standard close/minimise buttons
defaults write full-window -1

Hide the iTunes Genre list
defaults write show-genre-when-browsing -bool FALSE


Show hidden files
defaults write AppleShowAllFiles TRUE
killall Finder

Hide hidden files (default)
defaults write AppleShowAllFiles FALSE
killall Finder

Disable the OS X Crash reporter (quit dialog after an application crash)
defaults write DialogType none
To enable the crash reporter (default) change none to prompt

Disable dashboard widgets (saves RAM)
defaults write mcx-disabled -boolean YES
To Enable dashboard widgets (default) set this to NO

Disable the New Window Animation
$ defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool NO
To enable the animation (default) set this to YES

Set the font anti-aliasing minimum sizes, globally or per-application:
$ defaults -currentHost write .GlobalPreferences AppleSmoothFontsSizeThreshold -int 16
$ defaults -currentHost write .GlobalPreferences AppleFontSmoothing -int 0
$ defaults -currentHost write AppleAntiAliasingThreshold -int 16

Restore the the 'Save As' menu item (Equivalent to adding a Keyboard shortcut in the System )
$ defaults write -globalDomain NSUserKeyEquivalents -dict-add 'Save As...' '@$S'

Expand 'Save As…' Dialog Boxes by Default
$ defaults write -g NSNavPanelExpandedStateForSaveMode -boolean true


Two Dimensional Dock (disable the 3D mirror glass effect)
defaults write no-glass -bool YES
$ killall Dock

Three Dimensional Dock (default)
defaults write no-glass -bool NO
$ killall Dock

Disable Bouncing dock icons
defaults write no-bouncing -bool True
$ killall Dock
To re-enable, set this back to False

Dim the Dock Icon of any 'Hidden' Applications
$ defaults write showhidden -bool YES
$ killall Dock

Add a 'Recent Applications' stack to the Dock.
defaults write persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'
$ killall Dock
To remove - just drag out of the dock again

Change login screen background
sudo defaults write /Library/Preferences/ DesktopPicture "/Library/Desktop Pictures/Aqua Blue.jpg"

Stacks, Activate Mouse Over Gradient:
defaults write mouse-over-hilte-stack -boolean YES
$ killall Dock
To deactivate set back to NO


Terminal windows take focus with mouse over window:
defaults write FocusFollowsMouse -string YES
Terminal windows take focus with click (default)
defaults write FocusFollowsMouse -string NO

     Specifying domains:

     domain    A full domain name of the form com.companyname.appname. 

                     defaults read

     -app application
               The name of an application:

                     defaults read -app TextEdit

     filepath  Domains can also be specified as a path to an arbitrary plist
               file, omitting the '.plist' extension. For example:

                     defaults read ~/Library/Preferences/

               normally gives the same result as the two previous examples.

               In the following example:

                     defaults write ~/Desktop/TestFile foo bar

               will write the key 'foo' with the value 'bar' into the plist
               file 'TestFile.plist' that is on the user's desktop. If the
               file does not exist, it will be created. If it does exist, the
               key-value pair will be added, overwriting the value of 'foo' if
               it already existed.

               WARNING: The defaults command will be changed in an upcoming
               major release to only operate on preferences domains. General
               plist manipulation utilities will be folded into a different
               command-line program.

     -g | -globalDomain | NSGlobalDomain
               Specify the global domain.
               '-g' and '-globalDomain' can be used as synonyms for NSGlobalDomain.

     Specifying value types for preference keys:

                 If no type flag is provided, defaults will assume the value
                 is a string. For best results, use one of the type flags,
                 listed below.

     -string     Allows the user to specify a string as the value for the
                 given preference key.

     -data       Allows the user to specify a bunch of raw data bytes as the
                 value for the given preference key.  The data must be provided
                 in hexadecimal.

     -int[eger]  Allows the user to specify an integer as the value for the
                 given preference key.

     -float      Allows the user to specify a floating point number as the
                 value for the given preference key.

     -bool[ean]  Allows the user to specify a boolean as the value for the
                 given preference key.  Value must be TRUE, FALSE, YES, or NO.

     -date       Allows the user to specify a date as the value for the given
                 preference key.

     -array      Allows the user to specify an array as the value for the
                 given preference key:

                       defaults write somedomain preferenceKey -array element1 element2 element3

                 The specified array overwrites the value of the key if the
                 key was present at the time of the write. If the key was not
                 present, it is created with the new value.

     -array-add  Allows the user to add new elements to the end of an array
                 for a key which has an array as its value. Usage is the same
                 as -array above. If the key was not present, it is created
                 with the specified array as its value.

     -dict       Allows the user to add a dictionary to the defaults database
                 for a domain.  Keys and values are specified in order:

                       defaults write somedomain preferenceKey -dict key1 value1 key2 value2

                 The specified dictionary overwrites the value of the key if
                 the key was present at the time of the write. If the key was
                 not present, it is created with the new value.

     -dict-add   Allows the user to add new key/value pairs to a dictionary
                 for a key which has a dictionary as its value. Usage is the
                 same as -dict above. If the key was not present, it is cre-ated created
                 ated with the specified dictionary as its value.

Defaults allows users to read, write, and delete Mac OS X user defaults from a command-line shell. Mac OS X applications and other programs use the defaults system to record user preferences and other information that must be maintained when the applications aren't running (such as default font for new documents, or the position of an Info panel). Many settings can be changed through an application’s Preferences, but many settings are not shown in the GUI but can still bechanged using defaults.

In most cases the current value can be read with defaults read… it is worth checking the current setting before writing a new default (with defaults write…) just in case you want to revert to the old settings. If defaults read… returns 'does not exist' that means there is no setting currently stored, you can remove a setting with defaults delete…

User defaults belong to domains, which typically correspond to individual applications. Each domain has a dictionary of keys and values represent-ing representing ing its defaults; for example, "Default Font" = "Helvetica". Keys are always strings, but values can be complex data structures comprising arrays, dictionaries, strings, and binary data. These data structures are stored as XML Property Lists.

Though all applications, system services, and other programs have their own domains, they also share a domain named NSGlobalDomain. If a default isn't specified in the application's domain, but is specified in NSGlobalDomain, then the application uses the value in that domain.

A property list (or plist) can contain multiple values                  

e.g. to write a single value:
  defaults write com.ss64.myapp "Default Color" '(255, 0, 0)'

to write two values (plist)
  defaults write com.ss64.myapp '{ "Default Color" = (255, 0, 0);
                                   "Default Font" = Helvetica; }';

Defaults can be structured in very complex ways, making it difficult for the user to decipher or modify them.

“I am a leader by default, only because nature does not allow a vacuum” ~ Desmond Tutu


defaults man page -
Long list of OS X and App defaults from Mathias Bynens (+ older fork github) - Another extensive list of defaults
Show hidden files.scpt - Toggle the display of hidden files in Finder (will restart finder)

© Copyright 1999-2015
Some rights reserved