Apple - How to connect to a specific BSSID via Terminal?

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

/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.