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

10.4: Convert new plist files between XML and binary System 10.4
Tiger only hintApple has introduced a new .plist file format in 10.4. You'll notice that you can no longer just edit a .plist file in TextEdit or other text editors. The reason for this is that the files are now binary rather than raw XML.

Luckily for us, there is a command line utility called plutil that can convert back and forth between the two formats. You can convert the .plist file you want to edit to XML format, edit it in TextEdit, then convert back to binary for use. To convert a binary .plist file to XML format for editing, type this in the Terminal:
plutil -convert xml1 some_file.plist
To convert an XML .plist file to binary for use:
plutil -convert binary1 some_other_file.plist
Replace some_file.plist and some_other_file.plist with the actual filenames, obviously...
    •    
  • Currently 3.42 / 5
  You rated: 1 / 5 (12 votes cast)
 
[116,236 views]  

10.4: Convert new plist files between XML and binary | 14 comments | Create New Account
Click here to return to the '10.4: Convert new plist files between XML and binary' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Convert new plist files between XML and binary
Authored by: timkingman on May 03, '05 03:00:09PM

The binary plist format isn't new, but it is now the default with 10.4. Property List Editor opens both kinds, which may be easier than a text editor for some needs.



[ Reply to This | # ]
10.4: Convert new plist files between XML and binary
Authored by: belette on May 03, '05 03:05:04PM

you beat me to this ;-)



[ Reply to This | # ]
10.4: Alternatives to PropertyListEditor
Authored by: mgharris on May 05, '05 04:45:30PM
The trouble with Apple's PropertyListEditor is that it has no 'find' facility, much less search-and-replace, so I've usually looked at plist files in TextEdit or SubEthaEdit . The 'switch' to binary forced me to look for alternatives. I found PlistEdit Pro , which seems to do the job nicely, but costs $24.95. Anyone out there have another favorite?

[ Reply to This | # ]
10.4: Alternatives to PropertyListEditor
Authored by: mgharris on May 05, '05 04:49:39PM
Woops! that's PlistEdit Pro

[ Reply to This | # ]
10.4: Convert new plist files between XML and binary
Authored by: belette on May 03, '05 03:03:38PM

Or, you could use the Property List Editor program, which hides in your developer folder. The tools are on the Tiger DVD. It's much more user friendly for plist edition than TextEdit, anyway...



[ Reply to This | # ]
10.4: Convert new plist files between XML and binary
Authored by: echo on May 03, '05 05:17:33PM

This change has converted me over to using Property List Editor rather than BBEdit (which I had previously preferred for viewing + editing .plist files). You can extract just the Property List Editor using Pacifist, without installing any other parts of Xcode.



[ Reply to This | # ]
10.4: Convert new plist files between XML and binary
Authored by: ClarkGoble on May 03, '05 05:41:44PM

Which may have been Apple's intent. It's much harder to get badly formed plists that way.



[ Reply to This | # ]
10.4: Convert new plist files between XML and binary
Authored by: leenoble_uk on May 04, '05 04:53:32AM

I don't have Tiger yet so can someone answer this: does defaults read/write still work with these binary files or is there now a more convoluted method required to change an apps settings from the command line?
I any case it sounds a lot more difficult to determine exactly which parameters you need to set with defaults without first converting it in the way described above.

What are the chances that in the future they'll remove this ability by making the binary format as cryptic as .DS_store?

---
So, I said ... well, I can't actually remember exactly what I said. But it was one of the most enormously cruel and frighteningly witty put downs ever.



[ Reply to This | # ]
10.4: Convert new plist files between XML and binary
Authored by: chmod007 on May 04, '05 03:01:41PM
This command will print the XML list to standard output. plutil -convert xml1 -o /dev/stdout file.plist

[ Reply to This | # ]
10.4: Convert new plist files between XML and binary
Authored by: gospodin_david on May 04, '05 06:07:21PM

Yep. Defaults works just fine.



[ Reply to This | # ]
script here
Authored by: GlowingApple on May 11, '05 02:23:29PM
I often work in Terminal and enjoy the ease of sudo. So it's usually much easier for me to work with plist files in nano rather than opening a graphical app. For anyone who's interested, here's a simple script to convert a plist file, open it in nano, and then convert it back to the default binary format.

#!/bin/bash

plutil -convert xml1 ${1}
nano -w ${1}
plutil -convert binary1 ${1}
Just paste this in a file, chmod +x the file, and copy it to a location easy to access. I named mine pledit and copied it to /usr/local/bin.

---
Jayson --When Microsoft asks you, "Where do you want to go today?" tell them "Apple."

[ Reply to This | # ]

script here
Authored by: Hal Itosis on Jun 19, '05 06:56:43AM
Outstanding comment!!!

All I need do is type
pled /path/to/.plist
and the script does
all the conversions.

Cool. (works great)

Thanks Quantum0726,

-HI-

[ Reply to This | # ]
Use $EDITOR
Authored by: englabenny on Jun 19, '05 08:43:35AM
Put $EDITOR instead of nano, and that code will use any editor you've set up; for example, my $EDITOR is subethaedit.

[ Reply to This | # ]
script here
Authored by: jacobolus on Jan 14, '06 12:34:22AM
Or you can just stick this in your .bashrc

# to edit apple plist files:
function pledit {
plutil -convert xml1 ${1}
$EDITOR -w ${1}
plutil -convert binary1 ${1}
}


[ Reply to This | # ]