Raw Syntax

The stuff programs are made of

Comparing Plist Files on OSX


I recently had a problem with some of my keyboard shortcuts not working on OS X. I ended up moving the original plist (Property List) file, rebooting, and configuring the settings manually. This fixed the problem but left me wondering why the keyboard shortcut broke in the first place. Computers don't just break. There has to be a reason.

I tried to diff the two plist files and I got an unhelpful message similar to binary files differ. Having been on OS X a while, I know that plists can be saved as text or binary. In this case I simply used the open command to load the files into XCode, exported them as Property List XML, and then was able to diff them as normal text files.

Why Binary?

As an Emacs user, I was still confused as to why plists would ever be saved as binary. This just means I can't edit them with Emacs (out of the box anyway). Referring to the man page for plist it turns out the reason is performance:

The property list programming interface allows you to convert hierarchically structured combinations of these basic types to and from two formats: standard XML and an optimized, opaque binary format.

You can also use plutil to convert between binary and text. For example:

plutil -convert xml1 com.apple.symbolichotkeys.plist

Which converts the file to another format in place.