How to Use the macOS plutil Command to Edit Plist Files Safely

What is a Plist File?

In macOS, almost every application, background service, and system setting is configured using Property List (.plist) files. These files store preferences in a structured format (usually XML or a proprietary Apple binary format). For example, the hidden file com.apple.dock.plist dictates exactly where the Dock sits on your screen and which apps are pinned to it.

If you are a system administrator trying to automate macOS configurations, you might be tempted to use standard Linux text-editing tools like sed or nano to modify these plist files directly. This is extremely dangerous. If you make a typo in the XML syntax, or if the plist happens to be in a compiled binary format, a standard text editor will instantly corrupt the file, likely crashing the application entirely.

To safely read, edit, and convert plist files from the command line, Apple provides the plutil (Property List Utility) command. This native tool understands the exact structure of Apple’s preferences and ensures your edits never break the file syntax.

Step 1: Open the Terminal

Because you are modifying files from the command line, you must use the Terminal. Note that modifying system-level plists in /Library/Preferences/ requires sudo, while modifying your own user-level plists in ~/Library/Preferences/ does not.

  1. Press Command + Space to open Spotlight Search, type Terminal, and press Enter.

Step 2: Checking a Plist for Corruption

If an application like Safari keeps crashing immediately upon opening, its preference file might be corrupted.

You can use plutil to mathematically validate the syntax of any plist file without actually changing anything.

plutil -lint ~/Library/Preferences/com.apple.Safari.plist

If the file is healthy, the terminal will reply: “com.apple.Safari.plist: OK”. If the file is corrupted, it will tell you exactly which line of the XML code contains the syntax error.

Step 3: Converting Binary Plists to Readable XML

To save hard drive space and improve loading speeds, Apple compresses many plist files into an unreadable “Binary” format.

If you try to read a binary plist using the standard cat command, your terminal will flood with random garbage characters. You must convert it into readable XML first.

plutil -convert xml1 ~/Library/Preferences/com.apple.dock.plist

This safely transforms the file into standard XML formatting. You can now open it in any text editor, or read it directly in the terminal, to see exactly how the Dock is configured.

Step 4: Safely Editing a Plist File

The true power of plutil is the ability to programmatically inject or modify settings inside the file without opening a text editor.

For example, assume you have a custom plist named config.plist that contains a setting called AutoSaveEnabled, which is currently set to False. You want to change it to True.

You use the -replace flag, followed by the exact key name, the type of data (in this case, a boolean), and the new value.

plutil -replace AutoSaveEnabled -bool YES ~/Desktop/config.plist

The utility instantly modifies that specific setting while mathematically guaranteeing that the rest of the XML structure remains perfectly intact.

Alternative: Using the defaults Command

While plutil is excellent for safely manipulating physical .plist files on your hard drive, it is important to know that modern macOS heavily relies on an active background caching system for preferences (cfprefsd).

If you use plutil to manually edit com.apple.dock.plist, the Dock will likely ignore your changes because it is reading from the live RAM cache, not the hard drive file.

For making live changes to actively running macOS apps (like moving the Dock or hiding desktop icons), it is always better to use the defaults command (e.g., defaults write com.apple.dock orientation left), which automatically handles both the plist file and the live memory cache simultaneously.

Get the best tech tips delivered straight to your inbox.

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