Tuesday, March 09, 2004

Fixing problems with OS X preference files (from Macintouch)

MacInTouch Home Page
Ben Levi's note yesterday about fixing common problems with Mac OS X preference files brought several tips:

[Byron Han] From the Terminal, you can issue the following commands:

find ~/Library -name '*.plist' -exec /usr/bin/plutil -lint {} \;

and it will scan all of the plist files in your Library directory to see if they are corrupt or not....

[Alan Goates] The nice thing about most preference files is that they are actually well-formatted XML with DTDs to validate against. You can
do this with any validating XML parser, but here's an easy and free way to validate them all in one command line.
First download Xerces for Java, then cd into that folder (i.e. 'cd Desktop/xerces-2_6_2') from the command line and type

java -cp xercesImpl.jar:xercesSamples.jar sax.Counter ~/Library/Preferences/*.plist

If the file is really corrupted, this should catch it.

[Andreas Junghans] I suggest running the following in a terminal window:
sudo fs_usage | grep 'Sherlock' | grep 'plist'

This line monitors all file system access (sudo fs_usage) and filters out everything except access by Sherlock (grep 'Sherlock') regarding preference files (grep 'plist'). Note that you will be asked for your admin password since monitoring file system access is not allowed for ordinary users.

With this command running, start Sherlock, and you get a nice output of preference files (ending in .plist) that Sherlock accesses. The preference file causing trouble will usually be in '/Users/[your username]/Library/Preferences' or '/Library/Preferences'.

[Randy B. Singer] The corrupted preferences problem in Mac OS X isn't as complex as the extension conflict problem in Mac OS 8/9, so dealing with it is not as difficult. All that is required is a utility program that can make a backup copy of all of your user preferences files when your Mac is working well, and which can substitute all of the good preferences files for the suspect ones when a problem arises. This [free] program does exactly that: Back up user prefs.

No comments: