Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Control a wireless card from command line System
There is an officially supported, but well hidden by Apple, method of controlling supported wireless cards from command line. It doesn't look like this tool was mentioned here before, and I think it may be useful for many.

The tool is called airport (what a surprise!), and it's hiding in /System -> Library -> PrivateFrameworks -> Apple80211.framework -> Versions -> A -> Resources. It appeared there after one of the Panther updates, and Apple has actually been slowly improving it since then; it's really functional. Just go to that directory and launch it in Terminal (no root privileges required) like this:
$ ./airport -h
and you'll see all the available options. It can scan for broadcasting networks (-s), or for a hidden one if you know it's name (-sNAME). It can associate you with a network (-A), show you status of your card, and many other good things. I created a soft link for easy access to this little gem, and if you have admin privileges, you can make one like this:
$ sudo ln -s /System/Library/PrivateFrameworks/Apple80211.\
framework/Versions/A/Resources/airport /usr/bin
Enjoy!
    •    
  • Currently 3.40 / 5
  You rated: 4 / 5 (5 votes cast)
 
[25,086 views]  

Control a wireless card from command line | 12 comments | Create New Account
Click here to return to the 'Control a wireless card from command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Control a wireless card from command line
Authored by: wnorris on Jul 25, '05 09:18:55AM
though not really important in the scope of this hint, it's a good lesson to learn nonetheless -- it's generally a bad idea to muck around in /usr if you can keep from it. A better place for this symlink would be in /usr/local/bin.

[ Reply to This | # ]
Control a wireless card from command line
Authored by: melvinwalker on Jul 25, '05 12:26:00PM

or ~/bin.



[ Reply to This | # ]
Control a wireless card from command line
Authored by: jsumners on Jul 25, '05 09:41:09AM
My job is to maintain CSU's wireless network. When I got a Powerbook, I was disappointed to find there wasn't any tools like the Linux wireless tools, which I had been using to do my job, so I wrote one. It isn't as robust as this hint's tool is but mine is really meant for diagnostics and not card management. You can check mine out at http://freshmeat.net/projects/winfo/ if you are more interested in a diagnostic tool.

[ Reply to This | # ]
What version do you have?
Authored by: jecwobble on Jul 25, '05 10:55:30AM

I found the app, but -s is not an option for me. When using -h I get this:


./airport AirPort v.4.1 (410.22.0)
Command line tool for automatically joining recently trusted networks that are available
and for enquiring AirPort info.
Supported arguments:
	-a      --autojoin       join most recently trusted network that is available
	-f<arg> --file=<arg>     use <arg> as airport preference file instead of 
			/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
	-m<arg> --mac=<arg>      use <arg> instead of current AirPort MAC Address
	-x      --xml            print info as XML
	-h      --help           
	 --getinfo               
	 --scan                  
	 --showstack             
	 --all                   

I am using 10.3.9. Perhaps the -s option is included with 10.4?



[ Reply to This | # ]
What version do you have?
Authored by: Han Solo on Jul 25, '05 11:27:14AM
What's wrong with airport --scan ? Works for me on 10.3.9. airport --all is interesting too.

[ Reply to This | # ]
What version do you have?
Authored by: atverd on Jul 25, '05 12:13:53PM

You have Airport 4.1. With 4.2 Apple added a lot of new functionality to the tool. This has nothing to do with Panther vs. Tiger - just Airport software versions.



[ Reply to This | # ]
Control a wireless card from command line
Authored by: s_groening on Jul 25, '05 11:52:45AM

might this be a way of configuring an Airport Extreme card with Darwin 8? -I know that the particular PrivateFramework is not available, but might it actually be possible to move this to Darwin?

I know this is extremely speculative, however, depending on the bindings for this framework it might be able to configure the card, right? ...or am I too far out here??



[ Reply to This | # ]
Control a wireless card from command line
Authored by: jsumners on Jul 25, '05 03:51:09PM
Take a look at http://www.opendarwin.org/~bbraun/ap.tar.gz. A good bit of my application is based on that one. The ap application is meant to control a wireless card from within Darwin.

[ Reply to This | # ]
Control a wireless card from command line
Authored by: nukethis on Jul 25, '05 09:11:07PM

Is there anyway of making that Airport Radar menu show the hidden SSID's? That would be cool!



[ Reply to This | # ]
Control a wireless card from command line
Authored by: Whosawhatsis on Jul 26, '05 12:50:07AM
Another useful airport CLI tool: http://www.macstumbler.com/airport.tar.gz (direct download link).

---
I was offered a penny for my thoughts, so I gave my two cents... I got ripped off.

[ Reply to This | # ]

Control a wireless card from command line
Authored by: ornil on Jul 26, '05 11:45:02AM

It looks like it has an option (-m) to change the MAC address, but it doesn't seem to work for me. Anyone tried it?



[ Reply to This | # ]
Control a wireless card from command line
Authored by: jspivack on Aug 26, '05 12:11:46PM

Pure conjecture: rather than being for spoofing a MAC address, it might be for getting the information from a secondary Airport card (for example, a USB wifi adapter or something like that).



[ Reply to This | # ]