Install with GNU Stow:
git clone https://github.com/chbrown/plist-utils
cd plist-utils
stow -t /usr/local/bin bin
Convert a file in Apple's "property list format" into XML (whether binary or already XML),
then pretty print with xmllint
.
The plist file can be supplied as a single argument, or on /dev/stdin
.
plprint Config.plist
Simplify the XML of the given plist file with XMLStarlet,
replacing <data>
and <date>
elements with <string>
elements,
and convert to JSON.
pljson Config.plist
Convert each of the specified Apple Property List files to XML
in-place,
preserving file timestamps and permissions.
plxml settings.bin.plist
The macOS airport
utility has a scan option, -s
,
but by default, the output is unstructured and difficult to manipulate.
The -x
option produces XML that contains a lot more information in structured (if verbose) plist
format.
Using pljson
and a few other commands,
we can sort the available networks with strongest (largest RSSI) connections first:
airport -s -x \
| iconv -f macroman -t UTF-8 \
| pljson \
| jq -c '.[] | {SSID_STR,BSSID,RSSI,CHANNEL,CHANNEL_FLAGS,CAPABILITIES}' \
| mlr --ijson --opprint sort -nr RSSI
Pipeline components:
-
airport -s -x
: Run a network scan and produce XML output. -
iconv
: Convert encoding from Mac-Roman to UTF-8. Sometimes networks advertise names that are not UTF-8, whichairport
doesn't convert, despite clearly denoting the encoding asUTF-8
in the XML declaration. -
pljson
: Convert property list format to JSON. -
jq
: Flatten the top-level array and select just a few fields from each network dictionary. -
mlr
: Read in JSON and output whitespace-aligned tabular output, sorted by descending RSSI. RSSI ranges from -100 (weakest) to 0 (strongest).RSSI Description 0 impossibly strong -30 amazing -70 average -90 unusable
Copyright 2017-2018 Christopher Brown. MIT Licensed.