Find & Scan Wireless Networks from the Command Line in Mac OS X

Feb 28, 2012 - 8 Comments

Find and Scan Wi-Fi Networks in OS X Command Line

A long hidden airport command line utility buried deep in Mac OS X can be used to scan for and find available wireless networks

To do this, the first thing you’ll want to do is create a symbolic link from the airport utility to /usr/sbin for easy access. Launch the Terminal and type the following command:

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

The above command must appear on a single line to work properly. Enter the administrator password to create the symbolic link, which functions as an alias would in the Finder. Now you can use the airport command without the lengthy path to access it.

Now, to scan for and find all wireless networks within range, type the following:

airport -s

The list returned will show all available wifi networks and their router name (SSID), the router address (BSSID), signal strength (RSSI), channel, and security types used by the network.

list wireless networks

By watching the output of airport -s and the RSSI strength, you could use the airport command line tool in a similar fashion to the Wi-Fi Diagnostics utility to optimize a wireless connection.

You can also get much of the same detailed information from the Wi-Fi menu by holding the Option key on click, although that will only show you details of one access point at a time.

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: William Pearson in Command Line, Mac OS X, Tips & Tricks

8 Comments

» Comments RSS Feed

  1. sL1Per says:

    Nice one!! But id rather create and alias for it!
    alias airport=’/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport -$1′

    Cheers

  2. Gordon Gecko says:

    makes you wonder what other cool utilities are hiding in the depths of obscure os x directories…

  3. King says:

    how can I delete this alias now?

    • W says:

      it’s not an alias, it’s just a symbolic link so that you can type ‘airport’ at the command line rather than a giant path first.

      You can remove the symbolic link by typing:

      sudo rm /usr/sbin/airport

      There is no practical reason to do so, however.

  4. M San says:

    How do I connect to a wireless network using command line?

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

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