Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On a MacBook, if I hold Alt and click the AirPort icon in the menu bar, I get a bunch of extra data about the access point I'm connected to. Most interestingly for me right now is the WiFi channel.

How can I get this same info from the command line? ifconfig doesn't seem to include it.

share|improve this question
    
Mac OS doesn't include wlan-tools (that has iwconfig among other things) and a quick google search on iwconfig apple and similar tells me that you might be SOL. –  crasic Aug 15 '11 at 18:48

1 Answer 1

up vote 7 down vote accepted

There is an airport info utility that comes with Apple's 802.11 framework. It is a bit hidden though. If you want to call it without specifying the path every time, enter the following into the Terminal to link this utility somewhere you can call it from the PATH:

sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/bin/airport

Then you call it from anywhere. Just enter airport for a list of options.

airport -I

This would output:

charon:Resources werner$ airport -I
     agrCtlRSSI: -56
     agrExtRSSI: 0
    agrCtlNoise: -86
    agrExtNoise: 0
          state: running
        op mode: station 
     lastTxRate: 78
        maxRate: 144
lastAssocStatus: 0
    802.11 auth: open
      link auth: wpa2-psk
          BSSID: 0:23:69:14:ad:5c
           SSID: Supersaurus
            MCS: 12
        channel: 1

To get the channel only, pipe into grep:

 airport -I | grep channel
share|improve this answer
    
I would probably alias the command rather than sum link it, but that's like picking nits on a great answer. +1! –  bmike Aug 15 '11 at 19:58
    
Absolutely right. The symlink would make it permanently available to all users, so it's a matter of taste I guess! –  slhck Aug 15 '11 at 20:00
    
Subtle point - It's certainly more of a hassle / potentially fragile editing a system shell startup file rather than user level - sym links seem more preferable for the all user case. –  bmike Aug 15 '11 at 20:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.