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