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.
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
Post a Comment