Potential Differences

Wed, 10 Mar 2004

Automate Plist Verification

Mac OS X can have some hard to diagnose problems if preference files become corrupted. Based on an initial idea on Macintouch, I read a couple of man pages and came up with an /etc/weekly.local file that looks like this.

#!/bin/sh

echo "Checking preference plist integrity"
find /Users/gvaughn/Library -name '*.plist' -print0 | xargs -0 /usr/bin/plutil -s

In detail, we’re finding all the *.plist files under your home directory’s Library subdirectory (substitute your username for ‘gvaughn’). The 0 on the print and xargs uses a NULL separator so we can handle files with spaces in their name. Then all the found files are passed to plutil for syntax checking. The -s option says to be quiet unless there’s a problem.

I hope someone finds this useful. If you find ways to beef it up, please let me know.

potential differences [/mac] permalink