Understanding Plist Files in macOS
In macOS, almost all application preferences, system configurations, and launch daemon settings are stored in Property List (.plist) files. Historically, Apple stored these files as plain text XML, meaning you could open them in TextEdit and modify hidden settings easily.
However, to improve disk read speeds and system performance, Apple transitioned to storing most system .plist files in a compiled binary format. If you try to open a binary .plist file in a standard text editor, you will see a mess of garbled characters and strange symbols.
To edit these files safely, you must use the plutil (Property List Utility) command in the macOS Terminal. It allows you to convert binary files into readable XML, edit them, and convert them back to binary.
Step 1: Check the Format of a Plist File
Before you convert a file, you should check its current format. Open the Terminal (Applications > Utilities > Terminal) and use the -p (print) flag to safely read the contents of the file without modifying it.
For example, to read a Safari preference file:
plutil -p ~/Library/Preferences/com.apple.Safari.plist
The Terminal will output the contents of the file in a human-readable JSON-like format. This is excellent for quickly checking a setting, but it does not allow you to easily edit the file in a graphical text editor.
Step 2: Convert a Binary Plist to XML
If you need to make extensive edits to a .plist file, you should convert it into standard XML.
Warning: Always make a backup copy of a .plist file before converting or modifying it. If you corrupt a system preference file, the associated application may crash on launch.
To convert a binary file to XML, use the -convert xml1 flag:
plutil -convert xml1 ~/Library/Preferences/com.apple.Safari.plist
The file is converted in place. You can now open the file in TextEdit, BBEdit, or any standard code editor, and you will see perfectly formatted, easily editable XML tags.
Step 3: Convert the XML Back to Binary
Once you have finished making your edits and saved the XML file, you must convert it back into the binary format that macOS expects for optimal performance.
Use the -convert binary1 flag:
plutil -convert binary1 ~/Library/Preferences/com.apple.Safari.plist
The file is now a compiled binary again. For the changes to take effect, you generally need to restart the application associated with the .plist file, or occasionally restart your Mac.
Step 4: Verify the Integrity of a Plist File
If you manually edited an XML .plist file and accidentally deleted a closing bracket or quotation mark, the file will become corrupted. Before you convert it back to binary or launch the application, you should verify its syntax.
To test a file for errors, use the -lint flag:
plutil -lint ~/Library/Preferences/com.apple.Safari.plist
- If the file is structurally sound, the Terminal will output:
com.apple.Safari.plist: OK - If there is an error,
plutilwill tell you exactly which line number contains the syntax mistake, allowing you to go back into your text editor and fix it before it causes a system crash.