- defaults (software)
-
defaults is a command line utility that manipulates plist files. defaults is present in the Mac OS X and GNUstep operating systems, and it first appeared in the NeXTStep operating system upon which both of the aforementioned systems are based. The system stores each user's preferences set in a .plist file for each program stored at ~/Library/Preferences for user-specific preferences, and /Library/Preferences/ for global preferences. Either way, the defaults utility writes or reads from these plist files depending on the one given.
Usage
The most common uses of defaults is:
$ defaults read $PLIST_FILE # gets all $ defaults read $PLIST_FILE $PROPERTY_NAME # gets $ defaults write $PLIST_FILE $PROPERTY_NAME $VALUE # sets $ defaults delete $PLIST_FILE $PROPERTY_NAME # resets a property $ defaults delete $PLIST_FILE # resets preferences
$PLIST_FILE is replaced by the plist file, without the extension. plist files are named similar to Java packages: you take the software developer's domain name, reverse it, place a dot (.), and then the application's name followed by .plist. So for example, iTunes' plist file would be com.apple.iTunes.plist. When you pass the value to defaults, you remove the .plist:
$ defaults read com.apple.iTunes # prints all of iTunes' preference values
plist files store property lists and values. The $PROPERTY_NAME value becomes 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 -boolean FALSE # case-sensitive!
Replacing 0 with 1 or FALSE with TRUE returns the search bar to normal.
Sometimes, preferences cause corrupt applications. To reset Address Book's preferences, you would either remove ~/Library/Preferences/com.apple.AddressBook or issue the command
$ defaults delete com.apple.AddressBook
References
- defaults manual page, Apple Inc
Wikimedia Foundation. 2010.