Jump to content

MacOS/defaults

From Wikiversity

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


Usage

[edit | edit source]

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:

$ defaults read com.apple.iTunes # prints all iTunes preference values
$ defaults read com.google.Chrome # 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