Chapter 22. The Defaults System

Native Mac OS X applications store their preferences in the defaults database. This is made up of each application’s property list (plist) file, which is an XML file consisting of key-value pairs that define the preferences for an application or service of the operating system.

If an application has a plist file, every time you change its preferences, the changes are saved back to the plist file. Also included in the defaults database system are the changes you make to your system via the panels found in System Preferences (/Applications).

As an administrator, you may need to access your or another user’s preferences. This is done from the Terminal using the defaults command. This chapter covers Mac OS X’s preferences system, including the format and location of application and system preference files, how they work, and how to view and adjust their settings using the Property List Editor and the Terminal.

Property Lists

User-defined property lists are stored in ~/Library/Preferences, and the appropriate plist is called up when an application launches. Property lists can contain literal preferences set through the application’s Application Preferences dialog, or subtler things such as window coordinates or the state of an option (such as whether to display the battery menu extra in the menu bar, as shown in Example 22-1).

Example 22-1. The com.apple.menuextra.battery.plist file

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple ...

Get Mac OS X in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.