Paul Calnan
Published August 5, 2013

Occasionally, I've wanted to be able to poke around in a plist file while working in the terminal. You can open an XML plist in a text editor like Vim, but a binary plist just looks like gibberish.

Fortunately, you can convert a plist file into XML format with the following command:

plutil -convert xml1 INPUT_FILENAME

Alternatively, you can convert a plist file into binary format with the following command:

plutil -convert binary1 INPUT_FILENAME

Obviously, change INPUT_FILENAME to whatever file you want to edit.

I wrote a quick Python script to automate this. I called it edit-plist. It first checks the file type (using the file utility). If it's a binary plist, it converts to XML. Then it opens in the selected editor (Vim). Once the editor exits, if the file was originally a binary plist, it converts back to that format.