You can never have too many tools, and when they come free in macOS – in Sierra, at least – so much the better. This article is about a handy combination of Wi-Fi functions hidden away in one of Apple’s private frameworks, so its features could change without warning, and you must keep it a secret.
The tool is at /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport but don’t be deterred by its lengthy path. It doesn’t have a
man file, of course, and is currently undergoing something of a mid-life crisis: it looks like two separate tools rolled into one.
airport legacy command set
Ask for its usage info, with
and it offers you five conventional arguments:
- -c[arg] sets the first Airport interface to use the channel number given as arg
- -z dissociates the first Airport interface from any network
- -I prints the current status for the first Airport interface
- -s[arg] performs a wireless broadcast scan, which can be directed if you provide a channel number as arg
- –psk –password=[pwd] –ssid[arg] creates PSK from the given password pwd and SSID arg.
Of these, the wireless broadcast scan using
is probably most useful, as it reports the SSID, BSSID, RSSI (signal strength from -100 to 0), channel, and security information for all known base stations.
is also pretty handy, as it reports full details for the first Airport interface in that Mac. This includes signal strength, noise, transmission rates, link authorisation, channel, and more.
airport new command set
If you enter
-h, you will see the other side of this tool, which is used thus:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport interface verb
If you don’t specify the interface to be used, it will use the first Airport interface (en1 perhaps), just as with the old command set.
The verb must be one of:
prefs– which displays the Airport preferences, and can be used to edit them in detail
logger– monitors the Airport driver’s log facility
sniff– captures 802.11 frames over a specified channel to /tmp (requires sudo)
debug– enables and configures Airport debug logging
So, for example,
shows the current preference settings for the first Airport interface, in my case returning
AirPort preferences for en1:
Unable to retrieve JoinMode
You might then use
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport prefs DisconnectOnLogout=YES
to set disconnect on logout to true; changes to preference settings require
sudo to obtain elevated privileges.
Although some of these controls and preferences are exposed to the user, and some are accessible in other tools, this
airport tool could well come in handy, when you know what you’re doing.
(Thanks to @indi303 for drawing attention to this tool.)