How to connect to a specific BSSID via Terminal? [duplicate]

My internet provider has a service where I share part of my wifi connection with other subscribers and in return I can use their wifi connection when I'm close to a subscribers router. It's very similar to FON.

However, I'm sometimes at a location where there are three subscribers (A,B and C) nearby. All of them have the service enabled. The service shows up with the same SSID (let's name it ISP-Free), regardless of who the providing subscriber is. In the above case only one SSID shows up in my airport menu, and then my Mac decides by itself to which router (A,B or C) it connects.

This decision is not always perfect and it often connects to a router that has a weak signal. Using the Wireless Diagnostics tool (option+click on the airport icon) I can find the BSSID of the strongest ISP-Free router, but I can't connect to it.

This answer does not help me as this permanently changes the BSSID to which the SSID ISP-Free will be associated. I don't want that as I connect to the ISP-Free network at other locations as well where the automatic router selection works fine.

This solution is not working for me either as it works based on the SSID, not the BSSID.

So how can I connect to a specific BSSID without a changing the behaviour of the SSID permanently without third-party software?
I assumed Terminal would be the only solution, but maybe there's a hidden Apple tool somewhere.


/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -A 

no longer is a supported option, but the airport-bssid tool is good for seeing a list and connecting to a bssid manually.

https://github.com/deekayw0n/airport-bssid

see the README.md for usage.


You can use

airport -A=ssid -BSSID=bssidname -password=password 

To find out the BSSID

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -s