Use networksetup to change AirPort networks from the command line - 2 views
-
Jeff Johnson on 02 Dec 10Sure enough: networksetup -setairportnetwork Airport 'Your SSID Here' 'Network Pa$$wOrd Here' did just what I wanted, and it did not require an administrator password or sudo. If you need to get a listing of all of the current Wi-Fi networks which are broadcasting SSIDs, you can use 'airport -s' for a list which will also show what security measures are used. By the way, if you aren't familiar with networksetup, you should definitely read up on it. It has a lot of features that could come in handy. It also wields a great amount of power, so be careful. The command listed above is fairly innocuous but there is a lot more it can do.