Configuration files are a problem for both operating systems and applications. Where do you keep them, how are they structured? Traditional Unix systems use text files with wildly varying internal structures, and Windows used either binary data or text files. Windows now uses a central registry that is accessed by a "regedit" application, and most Unix systems still use text files.
The benefit of using a simple text format for configuration files is obvious: Assuming you know what file to edit, there's nothing new to learn; you use a text editor. There are no indexes or internal pointers to get out of whack. The text file may have specific structural requirements, but the structure is often obvious through visual inspection. From an application point of view, reading text files may be slower, but realistically that is almost insignificant. There is also the annoyance of converting any required binary values to and from text, but again, that shouldn't be anything that really slows down the process.
However, the ease of editing can be seen as a disadvantage also: if a proprietary tool is used, that tool can impose consistency checks and possibly avoid the introduction of incorrect data.
What's all this got to do with Mac OS X? As we know, OS X is Unix, but Apple has taken a different approach by using XML property lists for most configuration data. Using XML provides a consistent data format that is easily hand or program edited.
XML property lists are text, but text with definite structure. Every piece of information stored in an XML file follows the same XML syntax, which means that its possible to write programs to check the validity of these files. So, if an property list file gets corrupted, we can identify that problem by checking for proper XML syntax. The tool that does that is "plutil"
There's nothing difficult about this tool. Open up Terminal, and run:
sudo plutil -s ~//Library/Preferences/*.plist /Library/Preferences/*plist
I've read that plutil can think there's a problem where there is none, though I've never experienced that. It's not a bad idea to keep safe copies of known good plist files where you can get at them quickly if necessary.
Plists can be stored in binary format; plutil can convert such files back to text for manual inspection. See the man page.
If you have extreme fear of the command line, "Preferential Treatment" (https://www.versiontracker.com/dyn/moreinfo/macosx/22790) wraps plutil in a GUI interface for you.
Got something to add? Send me email.
More Articles by Tony Lawrence © 2009-11-07 Tony Lawrence
Any sufficiently advanced technology is indistinguishable from magic. (Arthur C Clarke)
Printer Friendly Version
Plists and plutil Copyright © December 2005 Tony Lawrence
Have you tried Searching this site?
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.
Printer Friendly Version