Something many people do, myself included, is copy an application’s preferences file—either from one Mac to another (as a quick way of getting an app configured to my liking) or to replace a damaged/lost preferences file using a Time Machine backup. Until recently, this process was really simple: quit the app in question, trash the existing prefs file, insert the new prefs file, launch app.
Enter OS X 10.9, aka Mavericks, aka “the easy prefs copy killer.” Apple has made changes to the way the preferences system works in Mavericks, and one casualty of those changes is the easy replacement of an application’s preferences file. A brief bit of before-and-after, and then we’ll get to the fix—or just click the Read More link to jump right to the fix.
In prior versions of OS X, preferences files were always read by the application at launch. So as long as the app wasn’t running, if you replaced its preference file, it would read the new file the next time you launched the program.
In Mavericks, preferences are managed by a background daemon, cfprefsd. This service reads the preferences file once, when you first run the app. It then (I believe) receives notifications if you change the program’s settings while the program is running, and then writes them to the actual preferences file at certain points in time. But cfprefsd always has a copy of those settings in its cache, and that’s what the app gets when it checks its settings. (This reduces hard disk access, which is important in conserving battery life in laptops.)
Here’s the important bit: After you’ve launched an app once, it seems that any subsequent launches also get their preferences from cfprefsd. So if you try the old “replace the prefs while the app isn’t running” trick, you’ll be quite surprised to find that your program launches with its previous settings. It will do this even if you simply delete (via Finder) the old prefs file!
So how do you get around this aggressive caching of preference files?
I’m aware of three solutions, though there may be others (please comment, if you know of a better way).
Method 1:
1. Quit the app
2. Open Terminal
3. Paste killall cfprefsd then press Return. This relaunches the prefs system
4. Now relaunch the app and it should read the modified prefs file
Method 2:
1. Quit the app, and make sure it is not set to run at login
2. Delete the app’s prefs file (typically in ~/Library/Preferences, for non-sandboxed applications)
3. Logout
4. Login
5. Copy the prefs file you want to use into its home
6. Launch the app
Method 3:
1. Quit the app, leaving the ‘bad’ prefs file in place.
2. Open Terminal, paste the following, and press Return: defaults delete 3. com.COMPANY_ID.APP_ID. Note that COMPANY_ID and APP_ID are taken from the name of the app’s preferences file. Using our own Moom for example, the preferences file is named com.manytricks.Moom.plist, so the command would be defaults delete com.manytricks.Moom.
3. Copy the prefs file you want to use into the ~/Library/Preferences folder.
4. Launch the app
No comments:
Post a Comment