Connecting to a Wifi SSID from the macOS command line

Sometimes it's useful to be able to connect to an SSID (or switch from one to the other) from the command line. Here is how to do this on macOS (tested on High Sierra):

networksetup -setairportnetwork [interface] [SSID] [password]

For example:

networksetup -setairportnetwork en0 SSID1
networksetup -setairportnetwork en0 SSID2
networksetup -setairportnetwork en0 MyHouseSSID MyPassword

Using this command to connect to the same SSID your already connected acts as a reconnect.

Comments

Popular posts from this blog

Review of the electronicgeek.ca PRUSA I3 EG-1 3D printer (part 4)

Review of the electronicgeek.ca PRUSA I3 EG-1 3D printer (part 2)

Review of the electronicgeek.ca PRUSA I3 EG-1 3D printer (part 1)