Pick of the Week - Nov 10 [Show all picks]
Path Finder 5 - A feature-laden Finder replacement
Submit Hint Search The Forums LinksStatsPollsFAQHeadlinesRSS
12,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 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[41,995 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 whomever 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 Tue, May 3 2005 at 3:00PM PDT
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 Tue, May 3 2005 at 3:05PM PDT
you beat me to this ;-)

[ Reply to This | # ]
10.4: Alternatives to PropertyListEditor
Authored by: mgharris on Thu, May 5 2005 at 4:45PM PDT
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 Thu, May 5 2005 at 4:49PM PDT
Woops! that's PlistEdit Pro

[ Reply to This | # ]
10.4: Convert new plist files between XML and binary
Authored by: belette on Tue, May 3 2005 at 3:03PM PDT
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 Tue, May 3 2005 at 5:17PM PDT
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 Tue, May 3 2005 at 5:41PM PDT
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 Wed, May 4 2005 at 4:53AM PDT
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 Wed, May 4 2005 at 3:01PM PDT
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 Wed, May 4 2005 at 6:07PM PDT
Yep. Defaults works just fine.

[ Reply to This | # ]
script here
Authored by: GlowingApple on Wed, May 11 2005 at 2:23PM PDT
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 Sun, Jun 19 2005 at 6:56AM PDT
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 Sun, Jun 19 2005 at 8:43AM PDT
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 Sat, Jan 14 2006 at 12:34AM PST
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 | # ]