Defaults (software)
Command-line utility
defaults is a command line utility that manipulates plist files. Introduced in 1998 OPENSTEP, defaults is found in the system's descendants macOS and GNUstep.
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.
defaults is also able to read and write any plist specified with a path, although Apple plans to phase out this utility in a future version.
01Usage
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 preferencesDOMAIN 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 valuesplist files store keys and values. The PROPERTY_NAME key is the name of the property to modify. For example, to remove the search field from Safari's address bar:
$ 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.AddressBookCompound values
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.
02Settings
Some example settings configurable with defaults under macOS:
| Key | OSX Version | Legal Values | Default Value |
|---|---|---|---|
| AppleAquaColorVariant | 10.8 | 1, 6 | 1 |
| AppleHighlightColor | 10.8 | RGB, 3 floats range 0-1.0 | "0.780400 0.815700 0.858800" |
| AppleShowScrollBars | 10.8 | Automatic, WhenScrolling, Always | Automatic |
| NSQuitAlwaysKeepsWindows | 10.8 | bool | false |
| NSAutomaticWindowAnimationsEnabled | 10.8 | bool | true |
| NSNavPanelExpandedStateForSaveMode | 10.8 | bool | false |
| NSWindowResizeTime | 10.8 | float:time in seconds | .2 |
| CGFontDefaultAllowsFontSmoothing | 10.14? | boolean |
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.
Sources and credits
This article is adapted from the Wikipedia article “Defaults (software)”, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.
Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.