3

Is there a built in command line utility to show information about Apple Airport networks and other wireless networks? Where? What's its usage?

  • 3
    What do you mean? Something like Airport Utility but then via commandline? – Rob May 16 '14 at 6:34
  • @Rob No. Airport Utility.app is a configuration and status checking utility for Apple Airport wifi routers. And I so appreciate you asking because my question is ridiculous and I need to edit it so it makes sense. You get a +1 – chillin May 17 '14 at 5:58
6

There is a command line wireless utility called airport, but it is not in the user $PATH to be able to call it without remembering where it is.

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport

so to make it available at the line, and put it where it really belongs, in Terminal:

 chillin@stack:~$ 
 chillin@stack:~$ 
 chillin@stack:~$ sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport
 chillin@stack:~$ 

And when calling it, gives great info about the wireless network you're connected to:

 chillin@stack:~$ 
 chillin@stack:~$ 
 chillin@stack:~$ airport -I
      agrCtlRSSI: -53
      agrExtRSSI: 0
     agrCtlNoise: -84
     agrExtNoise: 0
           state: running
         op mode: station
      lastTxRate: 48
         maxRate: 54
 lastAssocStatus: 0
     802.11 auth: open
       link auth: none
           BSSID: c0:a7:50:5d:46:b9
            SSID: starbucks
             MCS: -1
         channel: 3
 chillin@stack:~$ 
 chillin@stack:~$ 
 chillin@stack:~$ # ok, what else?
 chillin@stack:~$ # run a wireless scan!
 chillin@stack:~$ 
 chillin@stack:~$ 
 chillin@stack:~$ airport -s
                             SSID BSSID             RSSI CHANNEL HT CC SECURITY (auth/unicast/group)
                   MOTOROLA-616F8 b4:22:ed:3d:69:e4 -86  1       Y  -- WPA2(PSK/AES/AES)
                        starbucks c0:a7:50:5d:46:b9 -50  3       N  US WEP
 chillin@stack:~$ 
 chillin@stack:~$ 
 chillin@stack:~$ 
 chillin@stack:~$ 
 chillin@stack:~$ 
 chillin@stack:~$ 

for syntax and quick help:

 chillin@stack:~$ 
 chillin@stack:~$ airport -h
 Supported arguments:
  -c[<arg>] --channel=[<arg>]    Set arbitrary channel on the card
  -z        --disassociate       Disassociate from any network
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.
  -s[<arg>] --scan=[<arg>]       Perform a wireless broadcast scan.
                                    Will perform a directed scan if the optional <arg> is provided
  -x        --xml                Print info as XML
  -P        --psk                Create PSK from specified pass phrase and SSID.
                                    The following additional arguments must be specified with this command:
                                   --password=<arg>  Specify a WPA password
                                   --ssid=<arg>      Specify SSID when      creating a PSK
  -h        --help               Show this help
 chillin@stack:~$ 
 chillin@stack:~$ 
 chillin@stack:~$ 

outputs what looks like a man page, for examples and full help, call command without arguments:

 chillin@stack:~$ 
 chillin@stack:~$ 
 chillin@stack:~$ airport
 Usage: airport <interface> <verb> <options>

         <interface>
         If an interface is not specified, airport will use the first AirPort interface on the system.

         <verb is one of the following:
         prefs   If specified with no key value pairs, displays a subset of AirPort preferences for
                 the specified interface.

                 Preferences may be configured using key=value syntax. Keys and possible values are specified below.
                 Boolean settings may be configured using 'YES' and 'NO'.

                 DisconnectOnLogout (Boolean)
                 JoinMode (String)
                         Automatic
                         Preferred
                         Ranked
                         Recent
                         Strongest
                 JoinModeFallback (String)
                         Prompt
                         JoinOpen
                         KeepLooking
                         DoNothing
                 RememberRecentNetworks (Boolean)
                 RequireAdmin (Boolean)
                 RequireAdminIBSS (Boolean)
                 RequireAdminNetworkChange (Boolean)
                 RequireAdminPowerToggle (Boolean)
                 WoWEnabled (Boolean)

         logger  Monitor the driver's logging facility.

         sniff   If a channel number is specified, airportd will attempt to configure the interface
                 to use that channel before it begins sniffing 802.11 frames. Captures files are saved to /tmp.
                 Requires super user privileges.

         debug   Enable debug logging. A debug log setting may be enabled by prefixing it with a '+', and disabled
                 by prefixing it with a '-'.

                 AirPort Userland Debug Flags
                         DriverDiscovery
                         DriverEvent
                         Info
                         SystemConfiguration
                         UserEvent
                         PreferredNetworks
                         AutoJoin
                         IPC
                         Scan
                         802.1x
                         Assoc
                         Keychain
                         RSNAuth
                         WoW
                         AllUserland - Enable/Disable all userland debug flags

                 AirPort Driver Common Flags
                         DriverInfo
                         DriverError
                         DriverWPA
                         DriverScan
                         AllDriver - Enable/Disable all driver debug flags

                 AirPort Driver Vendor Flags
                         VendorAssoc
                         VendorConnection
                         AllVendor - Enable/Disable all vendor debug flags

                 AirPort Global Flags
                         LogFile - Save all AirPort logs to /var/log/airport.log

 <options> is one of the following:
         No options currently defined.

 Examples:

 Configuring preferences (requires admin privileges)
         sudo airport en1 prefs JoinMode=Preferred RememberRecentNetworks=NO RequireAdmin=YES

 Sniffing on channel 1:
         airport en1 sniff 1


 LEGACY COMMANDS:
 Supported arguments:
  -c[<arg>] --channel=[<arg>]    Set arbitrary channel on the card
  -z        --disassociate       Disassociate from any network
  -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.
  -s[<arg>] --scan=[<arg>]       Perform a wireless broadcast scan.
                                    Will perform a directed scan if the optional <arg> is provided
  -x        --xml                Print info as XML
  -P        --psk                Create PSK from specified pass phrase and SSID.
                                    The following additional arguments must be specified with this command:
                                   --password=<arg>  Specify a WPA password
                                   --ssid=<arg>      Specify SSID when creating a PSK
  -h        --help               Show this help
 chillin@stack:~$ 
 chillin@stack:~$ 
 chillin@stack:~$ 
 chillin@stack:~$ exit
  • You beat me to it by seconds :) Additionally, running airport -h gives you more options. – onik May 16 '14 at 5:31
  • sort of by design... refresh page ;-) – chillin May 16 '14 at 6:03
  • Is there any official documentation on this? I would need to do a directed scan (-s) but can't get the args working. – Sebastian Hojas Nov 28 '15 at 0:24
  • how do you set the DHCP range or tell it whether or not to use NAT? – Walrus the Cat Mar 25 '18 at 23:37

You must log in to answer this question.

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