The topic of this article may not meet Wikipedia's general notability guideline. (December 2016)
The name "defaults" derives from OpenStep's name for user preferences, Defaults, or NSUserDefaults in Foundation Kit. Each application had its own defaults plist ("domain"), under ~/Defaults for the user configuration and /Defaults for the system configuration. The lookup system also supports a NSGlobalDomain.plist, where defaults written there will be seen by all applications. In macOS, the Defaults part of the path is replaced by the more intuitive Library/Preferences. defaults accesses the plists based on the domain given.
Common uses of defaults:
$ defaults read DOMAIN # gets all $ defaults read DOMAIN PROPERTY_NAME # gets $ defaults write DOMAIN PROPERTY_NAME VALUE # sets $ defaults delete DOMAIN PROPERTY_NAME # resets a property $ defaults delete DOMAIN # resets preferences
DOMAIN should be replaced by the plist file name sans extension ('.plist'). plist files are named with reverse domain name notation. For example:
$ defaults read com.apple.iTunes # prints all iTunes preference values
$ defaults write com.apple.Safari AddressBarIncludesGoogle 0 $ # or $ defaults write com.apple.Safari AddressBarIncludesGoogle -bool NO # case-sensitive!
Using "1", "YES", or "TRUE" instead restores this to the default of including search.
Preferences can at times corrupt applications. To reset Address Book's preferences, either the file ~/Library/Preferences/com.apple.AddressBook.plist must be removed or the following command issued:
$ defaults delete com.apple.AddressBook
defaults prints values in the OpenStep format. It allows the VALUE to be arrays and dicts, as long as they conform to old-style plist syntax.
Some example settings configurable with defaults under macOS:
|Key||OSX Version||Legal Values||Default Value|
|AppleHighlightColor||10.8||RGB, 3 floats range 0-1.0||"0.780400 0.815700 0.858800"|
|AppleShowScrollBars||10.8||Automatic, WhenScrolling, Always||Automatic|
|NSWindowResizeTime||10.8||float:time in seconds||.2|
SS64 documents a set of other keys that can be changed for each software (not the global domain) in macOS. Other sites also document settings to be changed using defaults. Apple does not publish a complete list of these "secret knobs", but their support site does occasionally provide defaults commands for user to change a certain setting, such as the creation of .DS_Store.
GNUstep documents its defaults more clearly, so that there is no such thing as a "hidden settings" community like there is for macOS.
- Linux General Commands Manual –
- Darwin and macOS General Commands Manual –
- "User Defaults Summary for GNUstep Libraries". www.gnustep.org.
- "Unofficial macOS defaults man page". ss64.com.
- "macos - modifying a Plist from command line on Mac using Defaults". Stack Overflow.
- grg (26 August 2013). "macos - Enabling Scroll Bars In Mountain Lion?". Ask Different.
- "Disable 'Resume' system-wide". defaults-write.com. 26 September 2012.
- "10 terminal commands to speed up macOS High Sierra on your Mac". defaults-write.com. 11 November 2017.
- Bynens, Mathias. "mathiasbynens/dotfiles: .macos". GitHub. Retrieved 1 March 2020.
- "Issue 858861: No subpixel antialiasing under macOS Mojave". bugs.chromium.org.
- "System preference settings for macOS - macOS - SS64.com". ss64.com.
- "Top 11 Terminal Command Tricks for Mac That You Should Know". Guiding Tech.
- "Adjust SMB browsing behavior in macOS High Sierra 10.13 and later". Apple Support. Retrieved 5 January 2020. (type into a search engine to find more: site:support.apple.com "defaults write")
- NSUserDefaults documentation Apple Inc