airport
command, which is available on OS X systems. The utility is located in
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/
.
Help information on the command is available using airport -h
.
$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -h Supported arguments: -c[<arg>] --channel=[<arg>] Set arbitrary channel on the card -z --disassociate Disassociate from any network -I --getinfo Print current wireless status, e.g. signal info, BSSID, port type etc. -s[<arg>] --scan=[<arg>] Perform a wireless broadcast scan. Will perform a directed scan if the optional <arg> is provided -x --xml Print info as XML -P --psk Create PSK from specified pass phrase and SSID. The following additional arguments must be specified with this command: --password=<arg> Specify a WPA password --ssid=<arg> Specify SSID when creating a PSK -h --help Show this help
To view the status for a wireless connection, use airport -I
or airport --getinfo
.
$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I agrCtlRSSI: -67 agrExtRSSI: 0 agrCtlNoise: -86 agrExtNoise: 0 state: running op mode: station lastTxRate: 7 maxRate: 144 lastAssocStatus: 0 802.11 auth: open link auth: none BSSID: ec:44:76:81:e4:40 SSID: VA Internet MCS: 0 channel: 11
The signal strength for a connection is the value for
agrCtlRSSI
. "RSSI" stands for
received signal strength
indication. The higher the number, the stronger the wireless signal.
The maximum value that may be reported will depend on the wireless
devices being used. Cisco Systems wireless cards have a maximum value of
100 while Wi-Fi chipsets from Atheros will return a value from 0 to 128.
For Apple OS X systems, the value will range from a high of 0 down to
minus 100 (-100). The closer the number is to zero, the stronger the signal
while the closer the number is to negative 100, the weaker the signal
strength.
Since I only wanted to check the signal strength initially, I looked just for that value. The signal strength seemed to be ok for the waiting room I was in, though not terrific.
$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep agrCtlRSSI agrCtlRSSI: -74 $ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep agrCtlRSSI agrCtlRSSI: -68
If you want to monitor how the signal strength varies over time, you can
use commands like those below, which will show the value every x
seconds as specified by sleep x
, where x
represents the number of seconds to sleep between checks. Hitting
control-c will terminate monitoring.
$ while true; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep agrCtlRSSI; sleep 5; done agrCtlRSSI: -67 agrCtlRSSI: -67 agrCtlRSSI: -68 agrCtlRSSI: -66 agrCtlRSSI: -68 agrCtlRSSI: -69 agrCtlRSSI: -67 agrCtlRSSI: -68 agrCtlRSSI: -67 agrCtlRSSI: -67 agrCtlRSSI: -68 ^C
When I checked the signal strength seemed to vary little over the course of about a minute, since I ran the check every 5 seconds. When I increased the spacing between checks to 15 seconds and let the check run for several minutes, I saw the signal stength never rose above -67 with the lowest value being -75.
Note: you can have checks run more frequently by specifying a fractional
value for the sleep parameter, e.g., sleep 0.5
to reduce the
"sleep" period to half a second.
I then examined the noise level for the wifi signal, which is the
agrCtlNoise
value. When I checked it over a two minute
period, it remained high. Less negative values are preferable.
$ while true; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep agrCtlNoise; sleep 15; done agrCtlNoise: -88 agrCtlNoise: -88 agrCtlNoise: -88 agrCtlNoise: -86 agrCtlNoise: -84 agrCtlNoise: -89 agrCtlNoise: -88 agrCtlNoise: -86 ^C $
The maximum data rate is the maxRate
value, which will
remain constant, but the lastTxRate
value may vary.
$ while true; do /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | grep Rate; sleep 15; done lastTxRate: 5 maxRate: 144 lastTxRate: 5 maxRate: 144 lastTxRate: 5 maxRate: 144 lastTxRate: 7 maxRate: 144 lastTxRate: 5 maxRate: 144 lastTxRate: 7 maxRate: 144 lastTxRate: 20 maxRate: 144
The maxRate value is the maximum rate, or data throughput, that the Access Point is capable of; the rate is a theoretical maximum rate, which you won't likely realistically attain. In this case the maxRate value was 144 Mbs, but the values I saw for lastTxRate of 5 to 7 Mbs, with one instance of 20 Mbs, were far below the maxRate. Whenever I visited webpages, I seemed to lose connectivity to sites frequently.
If you wish to scan for available networks you can use
airport -s
.
$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group) VA Internet ec:44:76:81:e0:00 -77 11 Y US NONE IMM-VAH 00:24:36:a9:a8:9c -84 161 N US WPA(PSK/TKIP/WEP104) WPA2(PSK/AES,TKIP/WEP104) IMM-VAH 00:24:36:a9:a8:9b -78 10 N US WPA(PSK/TKIP/WEP104) WPA2(PSK/AES,TKIP/WEP104) TEST ec:44:76:81:e4:4d -77 36 Y US WPA2(PSK/AES/AES) VA Internet ec:44:76:81:e4:4f -77 36 Y US NONE M2ZCN 18:1b:eb:c5:f8:2d -77 6 Y -- WPA2(PSK/AES,TKIP/TKIP) Verizon MIFI4510L DE57 Secure 00:15:ff:26:de:57 -83 4 N US WPA2(PSK/AES/AES) VA Internet ec:44:76:81:e8:70 -85 1 Y US NONE VA Internet 04:fe:7f:49:b9:80 -83 1 Y US NONE VA Internet ec:44:76:81:e4:40 -66 11 Y US NONE
You can scan for a particular SSID with --scan="SSID"
where SSID is the particular
SSID you are interested in.
$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --scan="VA Internet" SSID BSSID RSSI CHANNEL HT CC SECURITY (auth/unicast/group) VA Internet ec:44:76:81:e4:4f -76 36 Y US NONE VA Internet ec:44:76:81:e0:00 -76 11 Y US NONE VA Internet ec:44:76:81:e4:40 -65 11 Y US NONE
When I last checked the status of wireless connectivity from the waiting room, I saw a lastTxRate of 13. We then went to the cafeteria and after I ate I checked the wifi status again and saw the lastTxRate had gone up considerably from what it was in the waiting room with the value being 130, though the agrCtlNoise value was still similar to what it had been. The agCtrlRSSI value improved, going from -66 in the waiting room up to -58 in the cafeteria indicating a stronger signal in the cafeteria.
$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I agrCtlRSSI: -66 agrExtRSSI: 0 agrCtlNoise: -90 agrExtNoise: 0 state: running op mode: station lastTxRate: 13 maxRate: 144 lastAssocStatus: 0 802.11 auth: open link auth: none BSSID: ec:44:76:81:e4:40 SSID: VA Internet MCS: 8 channel: 11 $ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I agrCtlRSSI: -58 agrExtRSSI: 0 agrCtlNoise: -92 agrExtNoise: 0 state: running op mode: station lastTxRate: 130 maxRate: 144 lastAssocStatus: 0 802.11 auth: open link auth: none BSSID: ec:44:76:81:e8:4f SSID: VA Internet MCS: 15 channel: 149 $
I did notice that the MCS value had changed from 8 to 15. For 802.11n wireless connectivity, the Modulation and Coding Scheme (MCS) index values range from 0 to 32 with particular index values associated with particular data rates - see the data rates table. An 802.11 Wi-Fi network has a maximum theoretical bandwidth of 600 Mbit/s. The table shows a data rate of 144.4 Mbs for an index value of 15 for a 20 Mhz channel with a 400 nanosecond guard interval.
Some time after leaving the hospital when I performed a wireless status check at another location with a wireless router that supports IEEE 802.11b/g/n, I saw a much better agCtlRSSI value of -34, indicative of the laptop receiving a much stronger wireless signal, with a maxRate of 72 Megabits per second.
$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I agrCtlRSSI: -34 agrExtRSSI: 0 agrCtlNoise: -91 agrExtNoise: 0 state: running op mode: station lastTxRate: 73 maxRate: 72 lastAssocStatus: 0 802.11 auth: open link auth: wpa2-psk BSSID: 94:44:52:5a:54:52 SSID: Maze MCS: 7 channel: 6
An 802.11n network can achieve 72 Mbs (on a single 20 MHz channel with one antenna and 400 ns guard interval)
Created: Tuesday April 28, 2015