How to Convert plist Files to XML or Binary in Mac OS X

Mar 10, 2016 - 4 Comments

Convert a plist file to XML or binary in Mac OS X

Plist files contain preference specifics and properties relevant to a particular application or portion of Mac OS X system software. Depending on where the plist file is located and what function they serve, they can either be in XML format, binary format, and sometimes even json. For users who need to modify a plist file or convert the file format to or from XML and binary, you can do so easily in the OS X Terminal with the help of the plutil command.


The great thing about this approach with plutil is that users can convert property list files to XML to make edits with a plain text editor, then back to binary for use by an application or system function again. This prevents the need for using Property List Editor in Xcode to edit plist files, which is a large download and a bit more cumbersome if you don’t need the other development tools bundled with Xcode.

To get started, launch the Terminal, found in /Applications/Utilities/

Converting a plist File to XML from Binary

Have a plist file that is in binary format you want to convert to XML? This can be particularly helpful if you wish to make an adjustment to a property list file in a text editor, without having to launch Xcode or a separate app.

plutil -convert xml1 ExampleBinary.plist

This converts the existing binary plist file into XML format, which can then be edited in just about any plain text editor, whether it’s vi, nano, TextEdit in plaintext mode, or third party apps like TextWrangler and BBEdit. You can also use Xcode to edit plist files as usual.

Converting a plist Binary File to XML Format

Want to convert a plist file in XML format to binary, or back to binary after making edits to it? Use the following command instead:

plutil -convert binary1 Example.plist

This changes the plist in XML back to binary format. Once it’s in binary format it will not be editable with a standard text editor again, unless you convert it back into XML, or use Xcode’s built-in property list editor tool. The modified binary list files can then be placed back into various system level or app level directories as necessary.

By the way, for those wondering why this tool is necessary, simply attempt to open a plist file in binary format with a text editor and you’ll quickly see the problem:

Binary plist file not editable in text editor

The same plist file, when converted from binary to XML, opens in a text editor as a typical XML file which can then be modified as desired, to then convert back to binary again:

Converted plist file into XML format from binary can be edited in text editors

This is obviously aimed at advanced users who need to modify and adjust plist files in the first place, as the average Mac user likely rarely encounters the files let alone needs to make edits to them.

.

Related articles:

Posted by: Paul Horowitz in Mac OS, Tips & Tricks

4 Comments

» Comments RSS Feed

  1. 1pwnch says:

    Hello, I would like to ask a question about plutil. When I was trying to convert some of the binary format plist into xml one. It turned out with the result of “Operation not permitted”. Do you have any simliar experience or know how to solve it?

    • leogama says:

      Hi. Your current user probably doesn’t have permissions to edit the file. By default, the ‘plutil’ command edits the file in-place. You could either:

      1. Use ‘sudo’ to elevate your privileges and modify the file. Example:
      $ sudo plutil -convert xml1 ExampleBinary.plist

      2. If you have at least reading permission, use the ‘-o’ command option to convert to a new file. Example:
      $ plutil -convert xml1 -o ~/ExampleXML.plist ExampleBirany.plist

      This last example saves the converted file at your home directory (usually “/Users/yourusername”).

      For more options, see the documentation for the ‘plutil’ command:
      $ man plutil

  2. Sebby says:

    You probably don’t need to convert the files back to binary for your applications to read them, actually. The libraries that handle PList files will simply parse the XML. This is useful because it means you can use both GUI and text editor to manage an app or server’s preferences simultaneously.

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site