Edit property lists in Terminal on Mac
Preference and configuration files in macOS use property lists (plists) to specify the attributes, or properties, of an app or process. An example is the preferences plist for the Finder in the Library/Preferences/ folder of a user’s home folder. The file is named com.apple.finder.plist. The default naming convention for a plist includes the distributor’s reverse DNS name prepended to the app or process name, followed by a .plist extension.
To edit property lists, use the defaults
command-line tool. The defaults
command is a powerful tool and, when you know the specific key and value in a property list you want to change, the defaults
tool is very efficient.
The defaults
tool works directly with the macOS preferences subsystem and is used by many apps in macOS to manage preferences and other settings. It can be built into shell scripts and lets you access preferences in the multiple domains that exist on a given computer.
Determine the names of the appropriate property list, key, and values. For example, the name for the Dock’s property list is
com.apple.Dock.plist
. (When invoking thedefaults
command, omit the .plist extension.)Enter the values following the
defaults
command:defaults write com.apple.dock orientation left
Restart the app or process, if necessary.
A simple way to do this is to use Activity Monitor to select the appropriate process, then click Quit Process. For this example, you would choose the process named Dock.
You can also edit property list files in Xcode, which provides a built-in property list editor. To use Xcode, double-click a .plist file in the Finder.
If you don’t have Xcode installed on your Mac, download it from the Mac App Store.