Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Preferential Treatment - Test XML preference files Pick of the Week
Preferential Treatment iconThe macosxhints Rating:
9 of 10
[Score: 9 out of 10]
  • Developer: Jonathan Nathan [Click on Preferential Treatment in left frame]
  • Price: Donationware / Open source
One of the subtle causes of OS X crashes and behavioral oddities is corruption in an XML preferences file. Normally, discovering this corruption is a bit of a trial and error process -- you notice an app is misbehaving, so you trash its prefs and see if things get better. Apple, however, included a Unix tool (as of 10.2 and newer) to help automate the process -- plutil. Using the Terminal, you can check your user's Preference files, for instance, by typing sudo plutil -s ~/Library/Preferences/*.plist.

This will generate a report showing which, if any, preference files have syntax errors. It's run as root because some preference files (such as TechTool4's) are owned by root, due to the way the apps run). The -s switch tells plutil to suppress output on successful files (those that test OK), leaving just the troublesome files in the output report. At that point, you can delete, move, or try to fix the flagged files (plutil was covered in more detail in this previous hint).

While this is handy, not everyone loves the Terminal (shocking, I know!), which is where Preferential Treatment comes in. This AppleScript Studio application wraps a nice GUI around plutil, and it lets you easily test both the user-level and system-level preference files. The output is an easy-to-read table showing the filename and a description of the problem.

Advanced users can even edit the preferences to add additional preference directories, change the script that's run, and modify the application used to edit a corrupt preference file (which you do by double-clicking any item in the output). A handy smart button reveals flagged files in the Finder, moves them to the trash, or lets you choose an app with which to open the file. There's a button to give the app admin privileges, too, so it can test those root-owned user and system-level files.

If you're handy in the Terminal, you probably won't need Preferential Treatment ... but if you'd rather have a nice GUI wrapper and an easy way to test all your XML preference files, give it a look.
    •    
  • Currently 1.44 / 5
  You rated: 4 / 5 (9 votes cast)
 
[19,334 views]  

Preferential Treatment - Test XML preference files | 11 comments | Create New Account
Click here to return to the 'Preferential Treatment - Test XML preference files' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Preferential Treatment - Test XML preference files
Authored by: alternatekev on Jun 23, '04 03:18:51PM

But.. What happens when Preferential Treatment's plist gets corrupted? ;)



[ Reply to This | # ]
Preferential Treatment - Test XML preference files
Authored by: hdms on Jun 23, '04 05:40:32PM

This proved to be a really useful tool that solved a hanging startup issue on a school eMac. Booting in Safe mode and running this utility off my thumbdrive found a corrupted /System preference, which I deleted. I rebooted the eMac, and it came back up no problem. I donated!



[ Reply to This | # ]
Preferential Treatment - Test XML preference files
Authored by: TrumpetPower! on Jun 23, '04 11:20:47PM

Great hint!

It'd also be a good idea to run it without the tilde; this will check system-wide preferences. With the tilde, it only checks the preferences for the account you run it from.

Thankfully...the program remained silent when I ran it. Then again, I haven't been having any problems....

Cheers,

b&



[ Reply to This | # ]
Preferential Treatment - Test XML preference files
Authored by: pyptoo on Jun 24, '04 02:07:36AM

I get this "/usr/bin/sudo: Argument list too long" message in Terminal...
Why is the argument list limited ?



[ Reply to This | # ]
Preferential Treatment - Test XML preference files
Authored by: geohar on Jun 24, '04 05:33:43AM

There is a maximum argument list length in the terminal. Try doing ls ~/Library/Preferences/*.plist

If there's tonnes (which I'm guessing there is), you may be able to get arround the limit by doing

cd ~/Library/Preferences/
plutil -s *.plist

That will at least remove the need for the prefix... If that doesn't work (boy you must have tonnes of preference files) then you'll have to split the list in two or more.



[ Reply to This | # ]
Preferential Treatment - Test XML preference files
Authored by: gdelfino on Jun 24, '04 09:55:43AM
Try using the xargs command. There is a good tutorial about it at about.com.

[ Reply to This | # ]
Preferential Treatment - Test XML preference files
Authored by: roncross@cox.net on Jun 24, '04 01:24:45PM

You can redirect as follows:

sudo plutil -s ~/Library/Preferences/*.plist > ~/Desktop/myplist.txt

Instead of having the output on your terminal screen, just save it to your Desktop and view it in the text editor. The file name will by called myplist.txt

thx
RLC


---
rlc



[ Reply to This | # ]
Preferential Treatment - Test XML preference files
Authored by: roncross@cox.net on Jun 24, '04 11:42:28AM

I tried the terminal plutil last night and its worked for me without reporting any errors. I have added the plutil to my maintenance routine.


thx
RLC

---
rlc



[ Reply to This | # ]
Preferential Treatment - Test XML preference files
Authored by: pyptoo on Jun 24, '04 06:58:26PM

Thank you all for your help !



[ Reply to This | # ]
Preferential Treatment - Test XML preference files
Authored by: nathanj on Jun 25, '04 12:44:44AM
One of the good things about being a Unix hacker is that suddenly I get to be a MacOSX hacker, too :-)

This snippet should work nicely from a terminal, but I haven't tested it :

sudo (find / -name \*.plist | xargs plutil -s)

Should go through every .plist file on the system.

[ Reply to This | # ]

Preferential Treatment - Test XML preference files
Authored by: pyptoo on Jun 25, '04 03:41:47PM

Get a "Badly placed ()'s" message when trying it



[ Reply to This | # ]