an osx hint

Command Line Wireless Tool for OS X

I went looking for the Macintosh equivalent of iwconfig today so that I could get a command-line readout of the current wireless signal strength. This is good for sniffing out WiFi reception "sweet spots" in the office, and for tuning antenna positioning on the access point.

Apple hides their airport command line tool at
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
There's no manual page, but the --help switch will tell you everything you need to know. :-)

Okay, so here's one way to make the airport command a little more useful: link it into /usr/sbin.
cd /usr/sbin
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport
Hmmm, what other private frameworks are there?

It seems only responsible to mention that stuff in the PrivateFrameworks folder is use-at-your-own-risk software. Not because it's buggy or unsafe (no promises) but because it's likely to change drastically in some near-future version of OS X.

That said, as a special bonus, here's a little PHP script I wrote called airquality.php to parse the output of "airport -I" and chart signal quality in real time.

<?php

$iwconfig
= '/usr/sbin/airport -I';

while (
1) {
$out = `$iwconfig`;

$outa = explode("\n",$out);

// get commQuality
list( $key, $value ) = explode( ':', $outa[0] );

print
str_repeat('+',$value)."\n";

usleep(100000);
}
?>


Good luck!

By Chris Snyder on October 31, 2005 at 12:12pm

permalink - uplink/email

jump to top