APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Plists and plutil

© December 2005 Tony Lawrence
December 2005

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.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> Plists and plutil

Inexpensive and informative Apple related e-books:

Photos for Mac: A Take Control Crash Course

iOS 8: A Take Control Crash Course

Take Control of the Mac Command Line with Terminal, Second Edition

Are Your Bits Flipped?

Take control of Apple TV, Second Edition

More Articles by © Tony Lawrence

Printer Friendly Version

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.

Contact us

Printer Friendly Version

Any sufficiently advanced technology is indistinguishable from magic. (Arthur C Clarke)

Linux posts

Troubleshooting posts

This post tagged:

Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode