loseby.net

articles and projects by Chad Loseby

AirPort CLI

In 10.3 and 10.4 at least, there is a very useful AirPort command line utility. It can be found at /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport. To see all of its options, type ./airport -h. Two of the most useful that I have found are -I and -s. -I provides a slew of useful information on your current connection:

$ ./airport -I
    commQuality: 54
     rawQuality: 32
 avgSignalLevel: -67
  avgNoiseLevel: -96
     linkStatus: ESS
       portType: Client
     lastTxRate: 54
        maxRate: 54
lastAssocStatus: 1
          BSSID: 00:12:a9:53:cc:c2
           SSID: airVTC
       Security:   cipher: WEP 40

I have used this command line utility in a few different cases. Using the -I switch, I have written a client-side script for OS X which sends the BSSID of the currently connected access point to a server periodically for voluntary location tracking. I call the system wifi-trac, and I plan to release it eventually. The other project that I have used the AirPort CLI for is a simple Cocoa application that I wrote for a project that displays the data.