You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Pb converting plist to binary format

Hi,

I have an XML plist generated by a perl program that I would like to convert to binary plist in a shell script. So I'm using the dedicated "plutil" program from the command line.

Alas it won't convert the plist to binary, leaving it in XML format wether I try :
plutil - convert binary1 fuel.plist
or
plutil -convert binary1 -o fuel2.plist fuel.plist
So I try this :
plutil -convert binary1 -o - fuel.plist
to send the result to the STDOUT.

Bingo, the output is definitely a binary plist as it starts with the "bplist" signature and is followed by lots of non human-readable characters.

But ... when I tried this :
plutil -convert binary1 -o - fuel.plist > fuel2.plist
Istill get that XML file !!

I tried with different filenames like fuel.db for the output in case plutil would reserve the .plist extension to XML format. I also validated the input file with plutil.

This is driving me crazy ... There must be something, but what ?

Any help appreciated 😉

Regards
Phil

MacPro 2x23" + more, Mac OS X (10.6.2), iPhone3GS 32Gb 3.1.3, iTouch v2 3.1.2 Pwnd

Posted on Feb 21, 2010 3:56 AM

Reply
4 replies

Feb 21, 2010 7:03 AM in response to etresoft

Actually I do ! I'm working in my Desktop directory !

But ... OMG ... I've just found !!

In fact both QuickLook and my text editor (here TextWrangler) convert binary plist files internally to their XML counterpart before showing them !!

Now I've tried with Smultron which actually revealed a binary plist file !

I should have checked the size of the file before plutil and after and noticed it had decreased from 41k to 8k !

Regards
Phil

Feb 26, 2010 4:59 AM in response to etresoft

Rather than 'cat' I would definitely suggest 'hexdump' as 'cat'ing a binay file to a terminal might lead to somewhat weird results. Try one of these:
%> hexdump -C fuel2.plist
%> hexdump -C fuel2.plist | less
%> hexdump -C fuel2.plist | head

Another possibility would be to test the type of the file using the 'file' utility:
%> file fuel.plist
fuel.plist: XML document text
%> file fuel2.plist
fuel2.plist: Apple binary property list

I think that's rather clear 🙂

HTH

Pb converting plist to binary format

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.