Plists and plutil

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.


Hate these ads?

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" (http://www.versiontracker.com/dyn/moreinfo/macosx/22790) wraps plutil in a GUI interface for you.


Technorati tags:



Comments /foo-mac/plists.html




Add your comments

ad

Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner


Views for this page
Today This Week This Month This Year  Overall
11491,387 3,566

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

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. We appreciate comments and article submissions.

Publishing your articles here

pavatar.jpg
More:
       - MacOSX




Unix/Linux Consultants

Your ad here - $24.00 yearly!

http://bcstechnology.net Full service Linux & UNIX systems integrator; Windows to UNIX/Linux Client-Server Specialist; Secure E-Mail & Website Hosting; Thoroughbred Software Developer; Custom Industrial Automation; Hardware & Electronics Experts; In Business Since 1985.


UBB Computer Services Support for Openserver, Unixware and Linux. Windows integration with Unix/Linux servers. Hardware, Backup and Networking issues. Located near Sacramento CA, we provide onsite support throughout Northern CA and Nationwide via remote access. We are a SCO Authorized Partner and a Microlite BackupEdge Certified Reseller.


SCO, OpenServer, UnixWare, software, servers, security, networks, installation, administration, troubleshooting, maintenance, Watchguard, firewalls, VPNs, e-mail. Visit us at http://opensystemscomputing.com and www.go2unix.com.









Change Congress


Related Posts