airport – the Little Known Command Line Wireless Utility

Jan 18, 2007 - 77 Comments

Terminal in OS X Hidden from the casual Mac user is a spiffy command line utility that allows you to view, configure, and troubleshoot your Mac’s wireless connection, entirely from the Terminal of OS X. This command has a help file but is otherwise but not much documentation, and judging by the obscure location of the command, Apple probably didn’t think it would be too useful for the average Mac user. But the hidden command line airport tool is very useful indeed, particularly for more advanced Mac users who want to have full control over their wi-fi hardware directly from the command line in OS X.

With that in mind, here is how to access the amazingly useful yet little-known airport tool, and how you can use it for some networking tasks too.

In case you’re wondering, yes the command line airport tool exists in nearly all versions of OS X, even modern versions that stopped calling wireless networking ‘airport’ and refer to it as Wi-Fi. OK let’s begin.

First, Get Easier Access to airport Wi-Fi Tool

The first thing you’ll want to do is create a symbolic link to the airport command, because it is situated in a very inconvenient location with a deep path, this helps for quick usage. Doing so is very easy, in the Terminal type the following:

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

The above may be a bit hard to read on some browsers, so alternatively you can use the following (it does the same thing, just split into two commands):

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

Whichever method you go with, the sudo command will prompt you for a root password, enter it and hit return.

Yes, that giant cryptic path through the depths of OS X is where Apple hid the wonderful airport utility, but by running the above command you have just linked that long path to the much shorter ‘airport’ , great.

Using the airport Wireless Tool in Mac OS X Command Line

Now that you have quick and easy access to airport with the above symbolic link, you can start using the airport tool.

For starters, you’ll probably find the -I flag and -S flags to be most useful and informative. Thus, type airport -I at the Terminal prompt, which will return something like the following:

$ airport -I
commQuality: 75
rawQuality: 59
avgSignalLevel: -40
avgNoiseLevel: -97
linkStatus: ESS
portType: Client
lastTxRate: 11
maxRate: 11
lastAssocStatus: 1
BSSID: 00:06:5b:2a:37:10
SSID: OSXNetwork
Security: none

Displayed is detailed information on wireless signal quality, noise, security, and other WiFi network attributes.

The airport command is more powerful than just being able to list information on the current wireless network though, you can actually manually adjust any wi-fi settings, network card settings, troubleshoot networks, change security types used on a connection, capture packets into a pcap file, join and leae networks, disassociate from a wifi network, prioritize routers and networks, see signal strength and interference, adjust wi-fi hardware drivers, and perform a huge variety of network troubleshooting functions too. This is easily one of the most powerful ways to interact with a wireless card on a Mac.

airport wi-fi network command in Mac OS X

While there is no manual page for the airport command, attaching the -h or –help flag to the command to will issue a brief list of flags and explanations of their function. You can also just run ‘airport’ at the OS X command line to get the full help file, shown below:

$ airport
Usage: airport [interface] [verb] [options]

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)
JoinModeFallback (String)
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
AllUserland – Enable/Disable all userland debug flags

AirPort Driver Common Flags
AllDriver – Enable/Disable all driver debug flags

AirPort Driver Vendor Flags
AllVendor – Enable/Disable all vendor debug flags

AirPort Global Flags
LogFile – Save all AirPort logs to /var/log/wifi.log

[options] is one of the following:
No options currently defined.


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

Sniffing on channel 1:
airport en1 sniff 1

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

As you can see, there is an abundance of options to interact with wireless networks by using the airport utility in OS X. Advanced Mac users should really get a kick out of this one, as it’s extremely powerful, and wildly useful. The next time you’re working on any wi-fi related task or wireless networking in general, remember the awesome airport tool.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS X, Tips & Tricks


» Comments RSS Feed

  1. anon says:

    That’s a great tip – nice find, OSXDaily.

  2. Shlomo says:

    Awesome! Thanks for the cool util

  3. Alpharetta says:


  4. Here’s another vote for “holy moly”! Now I’ll have to go dig through the system for any and all hidden executable binaries. Who knows what else is hidden?!

  5. nate says:

    There’s documentation available, just type:

    $airport –help

    Its not too informative, but there’s some info there.

  6. KB says:

    This tip has ended hours of pulling my hair out. I’d been having trouble with my Mac mini computer automatically joining random wireless networks rather than the *one* network I’d ever want it to join … and this is despite using Network Preferences to configure Airport to join only preferred networks by default; to ask before joining an open network; and to require an admin password to change wireless networks.

    I wrote a script which runs “airport -I” to notice when I’m not connected to my desired network and then to run airport –associate to rejoin. I’m using cron to run this script every few minutes, and my logs show this fixing things several times a day so far.

    This also allowed me to add a StartupItem so that I can have my mini (which runs my web site, etc.) join the correct network on startup before anyone even logs in. Before I found this tip, I couldn’t find a way to get my mini to join any wireless network until I logged in.

    • gurgan says:

      If you could please share that script for having airport connect pre-login, that would be awesome. I need airport to be connected at login so I can access network accounts. Silly Apple.

  7. anon says:

    Anyone know how to use this command line util to turn airport off?

  8. Mifilte says:

    airport -z unjoins all networks

  9. AirPorter says:

    To actually turn airport off, you simply take the AirPort network interface down like so:

    sudo ifconfig en1 down

  10. anon says:

    Still works in Leo! (That’s ‘cool’ for Leopard, Googlebots)

  11. tuco says:

    How do you spoof your MAC address on a PowerBook wireless card?

    $ ifconfig lladdr xx:xx:xx:xx:xx

    works on /dev/en0 but no luck on /dev/en1.

  12. Marco says:

    Hi man!
    This command is very useful, but I have a question:
    airport -I gives info about signal strenght with the line

    avgSignalLevel: -40

    I think this value is in dB.

    When you type airport -s, you have the list of all networks avaiable, but which is the parameter which identifies the signal strenght? I think it could be

    Sig 56

    But it is in Watt or what?

    • WifiAdminGuy says:

      Signal Strength is the “RSSI” field. It is in units of dB. Since we’re in power, when you double the signal strength you will see a 3 dB increase. Same with average signal level.

      (truth: I’m guessing this is dB because all the linux driver wifi code I have seen reports that all major cards report in dB)

  13. David says:

    Is there a way to use this utility to maintain a wireless connection? At work, I use my MacBook Pro with a wireless network (a building full of PC’s) that, when idle for very long, breaks the wireless connection, requiring logging on again. I have been unable to find a “stay connected” utilitiy for wireless like we used to have with modems.


  14. @David

    I’ve run into similar problems before with some networks that seem to have a strict policy on idling. To circumvent this, try constantly pinging a server (either on the network or outside). To do this, open your Terminal (spotlight for Terminal) and type the following:


    instead of you can use your LAN router or whatever other IP ( Just let that run in the background while you’re doing things, and your connection should stay alive since small amounts of data are constantly being sent.

    Hope that helps,


  15. Ryan says:

    Someone please help me. I have tried to use this command to associate via BSSID and cannot get it to work. So far as I can tell, all the other commands work fine. I have several routers that have the same SSID and I need to be able to specify which one to connect to. Can someone help me?

  16. vchoi says:

    Very nice command. Saved my day as I need to troubleshoot problems in my wireless network.

  17. […] As a temporary solution, I found how to re-connect from a command line, thanks to the blog article “airport – the Little Known Command Line Wireless Utility”. I’ve created the file and run it when required: […]

  18. Ricardo says:

    I have do this implementation in python to automatically reconnect to my wireless if disconnected:

    import os
    import time
    import logging

    TEMPFILE = “connection-info.txt”
    KEYWORD = “MyPlace”
    LOGFILE = “airport-reconnect.log”

    def is_connected():
    # Generate connection info
    os.system(“/usr/sbin/airport -I >” + TEMPFILE)
    # Read connection info
    f = open(TEMPFILE, “r”)
    data =
    # Check
    return KEYWORD in data

    def connect():
    os.system(“/usr/sbin/airport -a”)“Re-connected.”)

    if __name__ == “__main__”:

    # Logger
    try: os.remove(LOGFILE)
    except: pass
    format=’%(asctime)s %(levelname)-8s %(message)s’,

    # Loop
    while True:
    if not is_connected():

  19. walter says:

    I’m looking for a way to automate the wireless configurations of hundreds of laptops in my school.

    Can anyone point me to a solution?

    I’m configuring the wireless using peap with mschap v2 and a certificate, all the laptops are macbooks osx 10.4


  20. Weja says:

    Guys I really need your help ASAP :( I have this huge problem in turning my AirPort on. I cant select the Airport’s checkbox in my network port configurations and I dont know why??? I can select and deselect the rest of the ports (bluetooth, internal modem, built in ethernet, etc) but NOT the AirPort!!!!


  21. […] Next I remembered a very useful post about How to get the wireless signal strenght from you airport and I decided to put togheter my (very small) knowledges of RubyCocoa to create a script that make your mac to work as an hot spot detector. […]

  22. […] via: airport – the Little Known Command Line Wireless Utility – OS X Daily Search […]

  23. […] The Little Known Command Line Wireless Utility […]

  24. bm says:

    I’m having the same problem as Ryan (above), i can’t seem to get it to connect to one of multiple same-SSIDed routers using the BSSID. Anyone figure this out?


  25. 3cr0wn says:

    if you are just trying to disconnect your connection

    $airport -z

    to scan for available networks

    $airport -s

    to join you need root access

    $sudo airport -A

    you will then be prompted for the SSID you’d like to join.

    Great find, thanks for sharing.

  26. Jason says:

    You can add some code to automatically connect you the the SSID you like.

    $sudo airport -A –associate=SSID –password=PASSWORD

    Unfortunately, I can’t seem to figure out how to connect to SSIDs that are not broadcasted. Anyone have an idea?

  27. […]   My MacBook usually didn’t feel like reconnecting to my AirPort after waking up from sleep mode. I’ve finally been able to solve that problem usingthe aiport command line utility and SleepWatcher. Simply installed SleepWatcher, and created the following little script in~/.wakeup: […]

  28. anonymous says:

    macbook:Resources root# airport -h
    airport AirPort v.522.4 (522.4.0)
    Supported arguments:
    -z –disassociate Disassociate from any network
    -i[] –ibss=[] Create IBSS
    -x –xml Print info as XML
    -s[] –scan=[] Perform a wireless broadcast scan.
    Will perform a directed scan if the optional is provided
    -r –repeats= Repeat the command the specified number of times
    -A[] –associate=[] Associate to network.
    Will prompt for network name if arg is not specified
    and if necessary, for a password if the network is using WEP or WPA.
    The following additional arguments may be specified with this command:
    –bssid= Specify BSSID to associate with
    –password= Specify a WEP key or WPA password
    -I –getinfo Print current wireless status, e.g. signal info, BSSID, port type etc.
    -P –psk= Create PSK from specified pass phrase and SSID.
    The following additional arguments must be specified with this command:
    –ssid= Specify SSID when creating a PSK
    -c[] –channel=[] Set arbitrary channel on the card
    -h –help Show this help
    macbook:Resources root#

  29. […] Handy little wireless command line command. […]

  30. […] Re: Gestione airport da terminale On 15 Mag, 23:56, Massimo <rana…> wrote: Ti posto un sito di interesse…eless-utility/ ciao « aggiungere capitoli | Gli utenti windows » […]

  31. Gregory says:

    In response to Jason’s comment:
    “Unfortunately, I can’t seem to figure out how to connect to SSIDs that are not broadcasted. Anyone have an idea?”

    Try this syntax instead:

    $ sudo airport -A –ssid=ESSID –password=PASSWORD

    it worked for me.

    For spoofing mac you could try (tested on OS X 10.5.6):

    $ airport -z #optionally disconnect from network to hide your mac change
    $ sudo ifconfig en1 ether AA:BB:CC:DD:EE:FF #this can only be done when the interface is up (or at least from my experience)
    $ sudo airport -A –ssid=ESSID –password=PASSWORD #reconnect to network.

    Now the airport GUI will tell you your original mac address still, but when you are connected if you check output from ifconfig:

    $ ifconfig en1 ether|grep ether
    ether AA:BB:CC:DD:EE:FF

    similarly, if you have admin access to the router you can check the connected devices there and see your mac should have changed.

  32. the obvious says:

    I have an idea..
    I have an idea.. You can use an OS that doesn’t require you to and open command line utilities and terminals
    and write SCRIPTS just to accomplish the simpleist everyday tasks!!


  33. @DOH says:

    “I have an idea..
    I have an idea.. You can use an OS that doesn’t require you to and open command line utilities and terminals
    and write SCRIPTS just to accomplish the simpleist everyday tasks!!”

    You are implying OSX requires one to use terminal to perform some of the operations listed here.

    Well OSX doesn’t require this d-bag.

  34. Mark says:

    Does anyone know if there is a command switch to tell the NIC to run 20/40mhz? Network Utility displays 130 and that means the NIC is not set to 20/40. I wish there were a configuration utility to set these parameters like in Windoz. When running Bootcamp, I have no problem with wireless N settings and attain 270+ speeds. It is only a problem in OSX, which is, of course, why I have my wonderful MacBook Pro. I love my Mac, but I want more speed, and need my DIR-655 functionality.

  35. 한스의 생각…

    airport – the Little Known Command Line Wireless Utility 에어포트 상태를 커맨드라인으로 확인해야 할 때……

  36. Flüge Bangkok says:

    Thank you very much for the useful tips
    You have really saved my time .
    Since I have bought my new macbook, I have had a lot of difficulties to configure my wireless network settings.
    My laptop was automatically joining my neighbour’s network rather than the network I’d ever want it to join.
    That was bothering for me and I intended to bring it bag to the shop, but the laptop has a very nice design, That’s why I haven’t done it.

  37. […] is not readily accessible. We make it that way with the following command in Terminal (found here): sudo ln -s […]

  38. jim says:

    I can’t make this work on PPC computers running 10.4.11 only on intel 10.4.11 – here is the command I have been using
    airport -A –associate= –password=

    This is important to me because my network manager is changing our wireless security on 15 campuses and I need to make all the wireless macs change over…about 1000 G4 iBooks. Any ideas as to why the intel and ppc 10.4 computers act differently with the same command?

  39. jim says:

    Sorry for the 2nd post— more info – I CAN change and add associations to wireless networks on ppc and intel platform as long as they are not encrypted. Our change is going from unencrypted closed network to a wpa2 closed network. If I can make this work I can send remote commands with the security software we use on the Macs.

  40. […] the Airport, called “airport”. Only its buried pretty deep in the system. Visit this article to find out more. I’ll show you how to add this to your PATH to make sure its always available. We can use […]

  41. zaphod says:

    you can hold down the option key when clicking on the airport menu to get some of the more useful troubleshooting info.

  42. mystergag says:

    Nice CLI command….thanks.
    But we are protected by WPA2-Enterprise (so Radius in the back) So we have DOT1.x user and pass configure in the GUI for our WIFI connection.

    Is there a way to pass those informations by giving specifics arguments to the command airport.

  43. Chris says:

    Is there any way to turn up the roaming aggressiveness of the airport card? We have many APs here, but the airport card doesn’t always connect to the closest one, especially after moving around the office…

  44. Sweatermeat says:

    Another good command line:

    Did you ever fart so hard you ended up in another zip code?

  45. sony battery says:

    This tip has ended hours of pulling my hair out. I’d been having trouble with my Mac mini computer automatically joining random wireless networks rather than the *one* network I’d ever want it to join … and this is despite using Network Preferences to configure Airport to join only preferred networks by default; to ask before joining an open network; and to require an admin password to change wireless networks.

  46. […] airport – the Little Known Command Line Wireless Utility […]

  47. ww says:

    I’m having the same problem as Ryan (above), i can’t seem to get it to connect to one of multiple same-SSIDed routers using the BSSID. Anyone figure this out?

  48. […] rate 2MB, en windows hay que modificar el valor en las propiedades del adaptador y en os x? airport – the Little Known Command Line Wireless Utility – OS X Daily Juegue 8) […]

  49. Jonathan says:

    Just in case nobody know, but, most of the info you can get with this little command line util is available by simply holding down the ALT key on your keyboard before you click on the little wifi symbol in the top screen bar (on the right).

    By pressing ALT, it will revel a lot more information that the signal level, pretty much the same thing you get with #airport -I.

    There are lots of stuff like that hidden away in OSX. The principle as I see it is that most people don’t need to know that, so they hide it, but for power user, it’s usually as easy as holding down a key (usually ALT) before clicking on a lot of things to revel more advanced option.

    I guess, it would be nice to have an advanced options on/off switch somewhere in the system preferences for people who want to see all the available options.

    There you go!

  50. john says:

    Does anybody know how to connect to a specific ssid with the airport command ? It seems that in snow leopard the parameter “-A –associate” is no longer available…what else can be used to connect to a certain ssid by command line?? thks

  51. Jan van Haarst says:

    Since Snow Leopard you need to use the networksetup command to connect to a wireless network from the command line.
    Like this :
    sudo networksetup -setairportnetwork en1 SSID PASSWORD

    • Brian says:

      THANK YOU!!!

      I’ve been pulling my hair out trying to figure out why ‘sudo airport -associate’ or any of the other similar commands haven’t been working for me, and haven’t been able to find Snow Leopard stuff anywhere else.

    • Mike says:

      I’m using lion and couldn’t get this or the -A to work, any ideas?

  52. […] else is really valuable. Here’s a way you can do this through the command line using the airport wireless tool we’ve discussed in the […]

  53. […] Kriesel benutzt. Um an die W-Lan Daten zu kommen habe ich (da ich ein Macbook benutze) den Befehl „airport -s“ mit dem ProcessBuilder verwendet weil Java diese Funktion leider nicht zur Verfügung stellt. […]

  54. Dilli R. Maharjan says:

    Great Tips,
    Thanks man

  55. Mactard Shortbus says:

    Once again, Mac’s needlessly restrictive and retarded ‘Think Different’ meets up with BSD’s obsessive ‘stability’ and buries the command to print wireless info behind, what, seven directories? Why is ifconfig in $PATH but ‘airport’ (seriously? seriously? does the wireless make the computer fly? WTF?) is not? Why is ssh in $PATH but airport isn’t? Why is it that people smart enough to design with global menus, autohiding docks, multi-touchpads and the best laptop shell (the case, not the UI) ever don’t realize that wireless access is almost a necessity for enterprise and personal computer use in this day and age and that, silly me, I thought that it would be ‘faster’ to use a terminal than GUI to learn my wife’s work machine’s MAC address so we could fix the damn network.

    Of course, I realize the answer to my question is “because designers make terrible engineers and engineers make even worse designers” but I, like, thought they ‘Think Different’ out in Cupertino.

  56. […] command) that would let me see which AP I had associated with. After some digging around I found this webpage that told me that there is indeed a command (very well hidden) right there in the OS. For some […]

  57. […] osxdaily hat auch noch diese Zeile hier zum Besten gegeben, um einen einfacheren Aufruf zu gewährleisten: sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport Danach kennt das Terminal ein airport-Kommando =) […]

  58. WifiAdminGuy says:

    This is freakin’ awesome. Thanks for finding and posting this. I wish I had known about this sooner.

  59. […] OS X comes with a nifty little known command line wireless utility. To enable easy access to it, run the following to put it in the command line’s search path: […]

  60. nono says:

    Note that at least on 10.6, many airport infos are available when clicking on regular menubar airport icon with “Alt” key pressed.
    One of the many eastern egg embedded by Apple through ages!

  61. JohnAnthony says:

    Awesome tipp :)

  62. ed says:

    does anyone know a way to lock my wifi card of my macbook air to use (a) only ?

    on my PC I can change the driver settings of my wifi card to use 5.2ghz only and i would love to be able to the same on my mac.

    I want to do this because at my work there are multiple repeaters.

  63. […] long hidden airport command line utility buried deep in Mac OS X can be used to scan for and find available wireless […]

  64. Mac OS X says:

    […] Networking is pretty straightforward, and has its own command line utility, airport. […]

  65. Alan says:

    Does anyone know a command to remove a client wireless from my network? For example an iPhone from somebody that use my network wireless. Thanks for help

  66. mioico says:

    Wonder if there’s any counter part on IOS(8 meanwhile).
    Any ideas?


  67. Eliyah says:

    instead of linking the file into /usr/sbin like you suggested, you can also add the following line to your .profile (% nano .profile):
    alias airport="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport"

  68. PavelPage says:

    I did it in the two ways and i couldn’t:

    ln: ./airport: Operation not permitted

    i´ve tried to do it with the superuser and dose not works =/

    someone can help?


    • kevin says:

      Hi,Did you use OSX 10.11?
      See””,you can not write /usr/ ,but not /usr/local.
      So,try this:

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

Leave a Reply


Shop for Apple & Mac Deals on

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates