Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 9 down vote accepted

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

sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/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.

share|improve this answer
2  
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
add comment

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.