MacOS – Trouble opening plist files in text editor

macosplistxml

From Finder, I can preview a plist file without any difficulties. For example, using Quick Look with ~/Library/Preferences/com.apple.Safari.RSS.plist I get a nice preview of its contents:

Quick Look

However, if I then try to open the file, either with TextEdit, or any other editor (I've tried SublimeText, TextMate, Vim, Nano, and Coda 2 so far), the encoding appears to be off:

bplist00Ò_"FixedRefreshesInBackgroundSettings_(com.apple.PreferenceSync.ExcludeSyncKeys ¡ 2]^����������������������������`

Here's what it looks like if I open it with TextEdit:

TextEdit

I've tried changing the encoding in Sublime Text and other apps, but that doesn't help.

Any thoughts?

I'm running 10.8.4.

Best Answer

plist files are not necessarily plain text so they need to be run through a converter. Finder and Xcode (which has a plist editor) do this without telling the user

The binary format is documented in this C code so any application can convert it and someone has written a format description in English and more Apple documentation here but note that it references old paths in /Developer/Documentation

The command line program plutil can convert to and from XML

e.g. to view a binary property list in XML format on stdout:

plutil -convert xml1 -o - <file name>

Also to convert a binary to a XML plist in place and then leave it so that the user program can read either.

plutil -convert xml1 <file name>