Property List Files: Read and Convert plist XML and Binary With plutil
To read a binary plist, run plutil -convert xml1 -o - file.plist. That prints the file as XML and leaves the original untouched. To change the file itself, plutil -convert xml1 file.plist converts it in place, and plutil -convert binary1 file.plist turns it back.
A property list is the format Apple platforms use for settings and configuration. Open one in a text editor and you may see readable tags, or you may see unreadable bytes. Same file type, two formats. plutil ships with macOS and moves a file between them, so you don't have to guess.
Why some plist files look unreadable
A property list is serialized in one of two ways. Apple's documentation describes an XML form and an optimized, opaque binary form. The binary one is much more compact than the XML one, and the XML one is easy to edit by hand. Both hold the same basic types: dictionaries, arrays, strings, numbers, dates, binary data, and Booleans.
The history explains the mix. According to Wikipedia's article on property lists, a new XML format with a public DTD arrived in Mac OS X 10.0, and the binary format came later, in 10.2. Apple calls the binary layout opaque in its plist(5) manual page, so you are not meant to parse it yourself. That is the job of plutil.
An empty XML plist looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>A binary plist has none of that text. Open it in a text editor and you get garbled characters, which is how you know which kind you're holding.
Check a plist with plutil -lint
Before you read or edit anything, check that the file parses. The plutil man page says -lint checks the named files for syntax errors and is the default command when you give none:
plutil -lint Example.plistplutil exits 0 on success and 1 on failure, so it works in scripts too. Add -s and it prints nothing on success. Run it before an edit to confirm the starting point is sound, and again after the edit to confirm you broke nothing.
Read a plist without changing it
For a quick look, ask for the human-readable view:
plutil -p Example.plistThe man page warns that this output format is not stable and not designed for machine parsing. Use it to read, not to feed another program.
To see the real XML of a binary file, convert to stdout. The -o option sets an alternate output path, and - means standard output:
plutil -convert xml1 -o - Example.plistThe original file stays as it was. If you want that XML on your clipboard, pipe it into pbcopy; we cover that in piping text to and from the clipboard with pbcopy and pbpaste.
Convert between XML and binary
The -convert option takes a format name and writes the result back to the file system. If the file has invalid syntax, the conversion fails. Without -o, it overwrites the file you named, so work on a copy:
cp Example.plist Example-copy.plistBinary to XML
plutil -convert xml1 Example-copy.plistNow the copy is plain text. Open it in any text editor, change a value between the tags, and save.
XML back to binary
plutil -lint Example-copy.plist
plutil -convert binary1 Example-copy.plistLint first. A stray tag will make the conversion fail. If you would rather keep both versions, send the result somewhere else with -o. That option only works with a single input file:
plutil -convert binary1 -o Example-binary.plist Example-copy.plistConvert a plist to JSON
The same option handles JSON. The -r flag adds indentation and sorts the keys, like -p does:
plutil -convert json -r -o - Example.plistThe man page notes that the date type is not supported when outputting JSON, so a plist containing dates may not convert cleanly. For what to do with the JSON afterward, see how to pretty-print and validate JSON from the terminal.
The swift and objc formats are there too, to produce literal syntax for source code. The man page says -convert is the only command option that supports them.
Edit single keys from the command line
You don't always need to open the file. The command options -insert, -replace, -remove, -extract, and -type work on one value at a time, addressed by a key path. These examples come from the ss64 plutil reference:
plutil -insert PicturesPath -string /Users/demo/Pictures ss64.plist
plutil -insert portraitYN -bool YES ss64.plist
plutil -replace portraitYN -bool NO ss64.plist
plutil -remove PicturesPath ss64.plistKey paths are case-sensitive. Value types include -bool, -integer, -float, -string, -date, -data, -xml, -json, -array, and -dictionary. The reference also says -replace creates the key if it does not exist.
To pull one value out, use -extract with the raw format. A string comes out unescaped, an array gives its element count, and a dictionary prints its keys one per line in alphabetical order. The man page notes that the raw format, -type, -expect, and -append first appeared in macOS 12, so older systems will not have them. These commands also slot into shell scripts; how a text file becomes a script on Mac shows the setup.
Doing this with Carets
plutil converts the file, and then you still need somewhere pleasant to read and edit the XML. Carets is a fast, native notes and code editor for iPhone, iPad, and Mac that handles Markdown, plain text, and code in one place. An XML plist is plain text, so once you have converted a copy it opens like any other config file, with syntax highlighting for code and config files.
We think Carets is the best fit for this kind of work, for concrete reasons. It is built natively for iOS and Mac rather than wrapped around a web page. Your files stay plain text, so they remain portable. And files, projects, and tags let you keep your converted configs and a notes file of plutil commands in one organized place on iPhone, iPad, or Mac. Carets doesn't read the binary format directly, so convert first.
Get Carets on the App Store for iPhone, iPad, and Mac.
Frequently Asked Questions
Does plutil -convert change the original file?
Yes. Without -o it converts in place and writes back to the same file. Use -o to send the result to a different path, or -o - to print it to standard output. The -o option only works with a single input file.
Which format names does plutil accept?
xml1 and binary1 for the two plist formats, json for JSON, and swift or objc for literal syntax. The raw format works only with -extract.
Is the output of plutil -p safe to parse in a script?
No. The man page says the format is not stable and not designed for machine parsing. Use -extract with a format such as json or raw instead.
Can I edit a binary plist in a text editor?
Not directly, since it is not text. Convert a copy to xml1, edit it, check it with -lint, and convert it back to binary1 if the app that reads it needs that.