How to Convert, Validate, and Query Property List Files Using plutil in macOS

Property List (.plist) files form the architectural backbone of macOS configuration management, application bundling, LaunchAgents, LaunchDaemons, and system preference storage. In older operating systems, configuration was stored in plain-text XML plists. However, modern macOS versions frequently compile plists into compact, proprietary binary formats (bplist00) for high-speed serialization and storage efficiency. When system administrators, fleet engineers, or developers attempt to view or edit these binary files using standard text editors, they encounter garbled binary code. The native macOS command-line utility plutil provides comprehensive tools to validate syntax, convert between XML, binary, and JSON formats, and query or manipulate specific keys directly from Terminal.

Validating Property List Syntax with plutil -lint

Before deploying a LaunchAgent plist, editing application defaults, or modifying configuration profiles, validating syntax prevents launch failures and system errors:

plutil -lint ~/Library/LaunchAgents/com.example.service.plist

The utility parses the document against strict property list specifications:

  • If the file is structurally sound, Terminal outputs: ...service.plist: OK.
  • If the plist contains syntax errors—such as unclosed XML tags, mismatched dictionary keys, or invalid type declarations—plutil pinpoints the exact line number and parsing error description, saving hours of configuration troubleshooting.

Converting Between Binary, XML, and JSON Formats

plutil enables effortless bidirectional format conversion using the -convert parameter:

  • Convert Binary to Human-Readable XML: To convert a binary plist into editable XML text:
    plutil -convert xml1 com.apple.finder.plist
    You can now open and edit the file in any standard text editor like Nano, VS Code, or TextEdit.
  • Convert XML back to Optimized Binary: Once modifications are complete, compile the plist back into high-performance binary:
    plutil -convert binary1 com.apple.finder.plist
  • Convert Property Lists to JSON: For modern devops pipelines and automated scripting, plutil natively serializes property lists directly into compliant JSON markup:
    plutil -convert json -o - com.apple.finder.plist
    The -o - flag routes the JSON output directly to standard output (stdout), allowing seamless piping into command-line JSON processors like jq.

Querying Specific Keys Using Keypath Navigation (-p and -extract)

Rather than dumping an entire multi-thousand-line configuration file, you can extract specific keys using keypaths:

  1. To pretty-print an entire plist in human-readable formatted text without altering the underlying file format on disk:
    plutil -p /Library/Preferences/com.apple.TimeMachine.plist
  2. To extract a specific dictionary key or array value, use -extract with a keypath:
    plutil -extract "AutoBackup" raw /Library/Preferences/com.apple.TimeMachine.plist
    The raw format specifier returns the plain unadorned value (e.g., 1 or true), ideal for consumption within shell scripts and automation workflows.

Modifying and Inserting Keys Directly via the Command Line

Modern versions of plutil support direct in-place key manipulation using the -replace and -insert flags:

plutil -replace "RunAtLoad" -bool true ~/Library/LaunchAgents/com.example.service.plist

Supported data types include -bool, -integer, -float, -string, -date, -data, -array, and -dictionary. This eliminates the need for cumbersome string replacements via sed or awk, ensuring that structural data types and binary encodings remain pristine.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.