Working with Preference Files

Working with Preference Files

Whenever you make a change to a setting, whether it's a Mac OS X setting or an application-specific setting, that change is stored somewhere on your computer. Apart from a few system-level settings that are stored in your computer's low-level memory, preference settings are stored in preference files. Each application or preference pane has its own preference file to store its own settings. Generally, the only way users interact with these preference files is via the System Preferences application and application-specific preference dialogs. However, at times you'll want to access these files directly. In this section, I'll talk about why and how.

Where Are My Preferences?

Much like everything else in Mac OS X, there are several locations for preference files. User-specific preferences files—those that affect only a particular user—are located in ~/Library/ Preferences and are only modifiable by that user. System-wide preferences—those that affect all users—are located in /Library/Preferences and can only be changed or edited by an admin user. For example, the settings for your Mac's firewall are located here, and only an admin user can use the Sharing pane of System Preferences or manually edit the preference file itself.

In Chapter 1 I mentioned how Mac OS X's file organization provides for flexibility in allowing each user to customize their own computing environment. The location of preference files is a prime example of this organization.

Editing Preference Files Directly

Although you can access most system-and application-specific settings via System Preferences or application preference dialogs, there are often other settings available for which there is no interface provided. In older versions of the Mac OS, there was no easy way to access such features. However, in Mac OS X Apple has encouraged developers to use a standard preference file format, one that uses plain text and a well-known formatting code. What this means for you is that it's actually possible to open most preference files in a text editor such as OS X's Tech Edit or BBEdit (, make changes, save the file, and immediately see the changes in action.

That said, while it's possible to directly edit a preference file, that doesn't necessarily mean it's easy to understand it. Luckily, there are some excellent applications that allow you to view and edit preference files using a clear and relatively comprehensible interface. If you performed the earlier procedure to add additional folders to Desktop preferences' Collection menu, you've already used one, Property List Editor. The other good one is the freeware PrefEdit (, from the same guy who gave us TinkerTool. As an example of the power of these utilities, I'm going to show you how to turn off one of the Finder's most annoying (in my humble opinion) features—zooming rectangles.


If a setting exists, but the developer has not provided you with an easy way to access it, there is often a good reason! Be sure you know what you're doing before you edit any preference file, and be sure to make a backup copy of the file beforehand; if you experience problems after making a change, you can revert to the backup copy.

Turn Off Zoom Rectangles by Editing Finder Preferences

User level:



individual user



When you open a window in OS X, you see a "zooming" rectangle that expands the window until it reaches its full size; the window also "zooms" down when you close it. While this is a neat effect, after a while it starts to bug me a little bit—I just want my windows to open or close quickly and let me work. Unfortunately, the Finder preferences dialog doesn't let me change this behavior. This is one of the hidden preferences I mentioned, and we're going to change it using PrefEdit.

  1. Make a copy of the file ~/Library/Preferences/ This is your backup.

  2. Launch PrefEdit. By default it shows all of the preference files in your personal Preferences folder on the left.

  3. In the list of preferences, select In the middle window a list of all the settings contained in the file will appear.

  4. Since the setting doesn't officially exist, we're going to create it; in the Contents box, select Logical from the "Type to add" pop-up menu. In the Key field, type ZoomRects. Click the Add button. You've just created the Zoom Rectangle setting in the Finder's preference file. (Note: I happened to know what the setting was called; you can't just make up names for them.)

  5. In the list of settings in the middle column, scroll down and select it (ZoomRects). The value for that preference will show up in the column on the right, and a description of the preference, along with its contents (the setting) appear at the bottom of the window. Unless you've previously used another utility to change this setting, it should say Yes.

  6. In the Contents area, click on No (Figure 2.15).

    Click To expand Figure 2.15: Changing a Finder setting using PrefEdit

  7. Select File Update all values to save your changes.

Note that although we just created the ZoomRects setting, you could have also edited an existing setting by selecting it in the middle column and then changing its value.

In order for the changes to take effect, you need to relaunch the Finder. You can log out and then back in, or you can force quit the Finder (by selecting Apple Menu Force Quit, then selecting Finder), which will automatically relaunch. Your Finder windows should now open quickly and smoothly without the zoom effect. Note that we could have changed this setting using TinkerTool, but that would have spoiled all the fun of this exercise.


You can launch PrefEdit as root/admin (described in Chapter 1) and use it to edit system-level preferences in /Library/Preferences.

How Can a Preference Be Wrong? Troubleshooting Preference Files

Preferences files are subject to the same risks as any other data stored on a hard drive. They can be deleted or changed accidentally, and they can simply become corrupt and fail to work. Here are a few quick tips on how to keep your preference files working, and to keep the bad ones from causing you too much grief.

Back Up Your Preferences

I'll talk a good deal more about backing up in Chapter 15, but suffice it to say that if you keep a safe and recent backup of your ~/Library/Preferences folder, you'll always be prepared if something goes wrong with a preferences file, or if you accidentally delete or edit one and want the original back. You can simply quit the affected application, place the backup copy back in your Preferences folder and you're good to go.

Moving Preferences Files to Find Problems

If you're having trouble with a particular application, the first place to check is the preference file for that app. Quit the application, locate its preferences file in the ~/Library/Preferences folder (preference files generally have the name of the application in their name), and move the file to the Desktop. Re-launch the application and see if the problem is gone; if it is, the problem was most likely a bad preferences file. A new one was created when you re-launched the app, so you can simply go to the application's preferences dialog and set things up again. Or, if you had very complex settings that you don't feel like re-entering, you can simply restore an older, working copy of the preferences file from a backup.

If you can't find the specific preferences file for the offending application, or if you're having more general system-wide problems, you can actually move your entire ~/Library/ Preferences folder to the Desktop. Log out and back in—if the problem still exists, it wasn't caused by a bad preferences file. If it's gone, it was due to one of the files in your Preferences folder. You'll need to manually figure out which one it is. Move your Preferences folder back, and then start making educated guesses about which is the culprit. A good first step to take is to view your Preferences folder as List, then click the Date Modified column to sort by date. Concentrate on files that were changed recently, or since you started having problems, since most likely the file that is causing the problems was changed around the same time your problems began.