Find & Scan Wireless Networks from the Command Line in Mac OS X
A long hidden airport command line utility buried deep in Mac OS X can be used to scan for and find available wireless networks. This powerful tool is very helpful for network admins and systems administrators, but it’s handy for the average user to help discover nearby wi-fi routers as well.
To use this tool to find nearby wifi networks, 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.
How to Scan for Wireless Networks from Terminal in Mac OS X
Now, to scan for and find all wireless networks within range, type the following:
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.
This basically works like a command line wi-fi stumbler, revealing the available wireless networks that are within range.
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.
Alternatively, Mac users can turn to the Wi-Fi scanner tool native to OS X to stumble for nearby wireless networks entirely in the GUI. The output will be the same for either the Wireless Diagnostics app approach, or the command line approach offered here.