Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to get BSSID and the list of available Wi-Fi networks from within Terminal?

I.e. I'm looking for something similar to ifconfig run0 scan on OpenBSD, which lists all access points, BSSID, signal strength etc.

share|improve this question
up vote 13 down vote accepted

There's an airport utility buried that you'll want to use. Create a symbolic link in /usr/local/bin to the utility for quick access with this command:

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

Now, you should be able to run airport -s and get a list of available networks with BSSIDs.

If you hold the option key while opening the WiFi networks in the Menu Bar, you can also see the BSSIDs one at a time, although it seems like you wanted the CLI-like version from OpenBSD.

UPDATE:

"rootless" AKA System Integrity Protection (SIP) has been added to OSX since I wrote this answer originally, which makes /usr/bin and /usr/sbin read-only. It is proper to use /usr/local/bin, so I have updated the answer so that the symbolic link is created there.

share|improve this answer
3  
Better than creating a symlink would likely be to create an alias in your shell initialization. alias airport="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current‌​/Resources/airport" Doesn't need sudo privileges hence is available for non-admin users alike and doesn't affect other users. – MacLemon Feb 6 '13 at 18:55
1  
1) "Better" is relative. If you are the only user of a Mac, then non-admin users and other users are not a concern, and having the command linked somewhere in your $PATH which means you can use it in other scripts and shells (although I'd opt to link it to /usr/local/bin/). 2) The airport command has been at that path at least since 10.6 and possibly earlier, for people who are concerned about backwards compatibility. It is still there in 10.8 as well. – TJ Luoma Feb 13 '13 at 22:32
    
I suggested the symbolic link for the same reason TJ suggested, because you have got to have it linked to your $PATH, so I figured maybe the symbolic link would be less likely to give issues. Plus, many users do not use (or know how to use) .profile or .bash_profile. Both solutions work perfectly well :) – SoFLy Feb 14 '13 at 2:04

This worked in linux terminal:

sudo iwlist wlan0 scan

share|improve this answer
1  
lol, OS X answers here, please! – cnst Jun 8 at 2:54
sudo iwlist wlan0 scan | grep ESSID
share|improve this answer
    
sudo: iwlist: command not found. Which OS X version are you using? – patrix Dec 30 '15 at 11:48
    
iwlist is a Linux tool. labs.hpe.com/personal/Jean_Tourrilhes/Linux/Tools.html – Alistair McMillan Dec 30 '15 at 12:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.