15

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.

1
  • 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, 2011 at 18:48

1 Answer 1

16

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
4
  • 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, 2011 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, 2011 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, 2011 at 20:07
  • Starting from EI Captain, due to System Intergrity Protection, one may fail to create symbolic link even with sudo. In this case, try to add following into shell profile (e.g. ~/.bashrc) alias airport='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport'
    – Quar
    Sep 9, 2020 at 21:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .