MacOS/defaults

defaults is a command line utility in macOS that manipulates plist files.

Usage
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 sans extension ('.plist'). plist files are named with reverse domain name notation. For example:


 * # prints all iTunes preference values
 * # prints all Chrome 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!

Replacing 0 with 1 or NO with YES or FALSE with TRUE returns the search bar to normal.

Preferences can at times corrupt applications. To reset Address Book's preferences, you would either remove the file ~/Library/Preferences/com.apple.AddressBook.plist or issue the command:

$ defaults delete com.apple.AddressBook