Skip to content

MacOS plutil command

The MacOS plutil command is a powerful utility for working with property list files. With plutil, users can easily validate, convert, and modify .plist files, which are used to store configuration data. This command-line tool supports various operations, such as checking the syntax of a plist file, converting between binary and XML formats, and even extracting specific values from a plist file. Whether you need to troubleshoot plist files, automate tasks, or simply manipulate configuration settings, the plutil command provides a simple and efficient solution for macOS users.

plutil Syntax:

Terminal window
plutil [option] [parameter]

Options:

OptionDescription
-p, —printPrint the property list in a human-readable format.
-lint, —lintCheck the property list file for syntax errors.
-convert formatConvert the property list to the specified format (xml1, binary1, json).
-o output_fileSpecify an output file for use with the -convert option.
-extract keyPathExtract a specific value at the specified keyPath.
-replace keyPathReplace the value at the specified keyPath with a new value.
-e, —extractExtract the value associated with a specified key path.
-r, —replaceReplace the value associated with a specified key path.
-e, —eraseErase the value associated with a specified key path.
-s key valueSet the value associated with the specified key.
-remove keyRemove the entry associated with the specified key.
-helpDisplay help information for the plutil command.

Parameters:

ParameterDescription
input_fileSpecify the input property list file.
keyPathSpecify the key path to extract or replace.
valueSpecify the value to set or replace.
formatSpecify the format to convert the property list to.
output_fileSpecify the output file for the -convert option.

plutil Usage:

Convert a plist file to JSON

Terminal window
plutil -convert json file.plist

Converts the file.plist in plist format to JSON format.

Check the syntax of a plist file

Terminal window
plutil -lint file.plist

Checks the syntax of the file.plist to ensure it is valid.

Convert a JSON file to a plist file

Terminal window
plutil -convert xml1 file.json -o file.plist

Converts the file.json in JSON format to a plist file named file.plist.

Display formatted output for a plist file

Terminal window
plutil -p file.plist

Displays the formatted output for the file.plist in a more human-readable form.

plutil Usage:

How do I check the syntax of a property list file using plutil in MacOS?

To check the syntax of a property list file in MacOS with plutil, use the following command:

Terminal window
plutil -lint path/to/property_list.plist

How do I convert a property list file to XML format using plutil in MacOS?

To convert a property list file to XML format in MacOS using plutil, run the command:

Terminal window
plutil -convert xml1 path/to/property_list.plist

How do I convert a property list file to binary format using plutil in MacOS?

To convert a property list file to binary format in MacOS using plutil, use the command:

Terminal window
plutil -convert binary1 path/to/property_list.plist

How do I extract a value from a property list file using plutil in MacOS?

To extract a specific value from a property list file in MacOS with plutil, execute the command:

Terminal window
plutil -p key path/to/property_list.plist

How do I modify a property list file using plutil in MacOS?

To modify a property list file in MacOS using plutil, use the following command:

Terminal window
plutil -replace key -string 'new_value' path/to/property_list.plist

How do I validate a property list file against a schema using plutil in MacOS?

To validate a property list file against a schema in MacOS with plutil, run the command:

Terminal window
plutil -lint -s schema.plist path/to/property_list.plist

Applications of the plutil command

  • Convert property list file formats
  • Validate property list files
  • Print property list file in different formats
  • Modify property list files