plist extractor is a command line utility for macOS 13+
Related blog articles at: https://www.brunerd.com/blog/tag/plx
plx 1.0 - plist extractor
A tool for extracting data within plists
Usage:
plx [option] [file/domain] [query]
Arguments:
[file/domain] - Optional (if piped/redirected input), filepath or preference domain name
[query] - Optional, key or colon-delimited key path (PlistBuddy-style), pipes delimit paths within data embedded plists
Description:
• plx takes a binary or ascii property list and renders it as plaintext if possible or ASCII XML
• Input can come from file redirection, piped input, filepath or domain name argument
• Individual values can be extracted using a colon delimited key path
° Use a pipe character (quoted or escaped) to specify paths within plists encoded as data
• Data types are base64 decoded and output raw or if plist data, processed further
• Simple types (except data) are output by default as plaintext
• Dicts are always output as an XML property list (and not plaintext, unless empty)
• Arrays are rendered as plaintext only if they do not contain dict or data types
• Date types remain in native ISO 8601 format, use -e to convert to epoch
Options (pick one):
Help/Informational:
-h this help text
All types:
-t print abstract type of plist or query results
-x ensure XML output; inhibits both data type decoding and plaintext output
Array and dict types:
-l list all keys within a dictionary or print length of an array
Date types:
-e output ISO 8601 date in epoch time instead
XML property list abstract types:
Simple/primitive types: string, integer, date, data, real, bool
Complex/container types: dict, array
References:
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/PropertyLists/AboutPropertyLists/AboutPropertyLists.html
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/PropertyLists/UnderstandXMLPlist/UnderstandXMLPlist.html
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/UserDefaults/Introduction/Introduction.html
man pages: plist(5), plutil(1), PlistBuddy(8), defaults(1)
Examples:
#zsh only, this ignores comment lines if you copy/paste the examples below
set -k
#list all the key names in a pref domain (or specified path)
plx -l .GlobalPreferences
# plx will decode binary plist data and display as plaintext if possible or XML if not
plx com.apple.CloudSubscriptionFeatures.cache :ai.apps.image-playground
# You can inhibit decoding of a plists in data types with -x (not so useful)
plx -x com.apple.CloudSubscriptionFeatures.cache :ai.apps.image-playground
# Add the pipe character (colon optional) and it traverses into the data plist
plx -x com.apple.CloudSubscriptionFeatures.cache ':ai.apps.image-playground|'
# List all key names within plist data
plx -l com.apple.CloudSubscriptionFeatures.cache ':ai.apps.image-playground|'
# Specify a paths within a data plist after a pipe character (quoted or escaped)
plx com.apple.CloudSubscriptionFeatures.cache ':ai.apps.image-playground|:value:canUse'
# Dates can be output in epoch with -e, otherwise they are ISO 8601
plx -e com.apple.CloudSubscriptionFeatures.cache ':ai.apps.image-playground|:fetched'
Related blog articles at: https://www.brunerd.com/blog/tag/plx
Source and updates at: https://github.com/brunerd/plx
plb is a larger version of plx with additional features for exploring: https://github.com/brunerd/plb