Friday, 4 January 2019

wireless networking - Connect to WiFi network using Mac Terminal


Every time I try to find out how to do this, I find out how to do it on a linux, and it doesn't transfer. How do I connect to a WiFi network using Mac Terminal Bash?



Answer



As of Snow Leopard (Mac OS X v10.6.x) and possibly earlier, you can do:


networksetup -setairportnetwork $INTERFACE $SSID $PASSWORD

Where...



  • $INTERFACE is the "enX" style identifier for your AirPort card (usually en1, but it's en0 on MacBook Airs and en2 on Mac Pros, and can vary for other reasons as well)

  • $SSID is your network name, such as "Simon's SSID". Enclose it in quotes if it contains spaces.

  • $PASSWORD is your WEP, WPA-PSK, or WPA2-PSK password.


If you look at the man page or help/usage statement for networksetup you'll see that it has other AirPort-related subcommand for getting or setting the power state (AirPort card on/off), and for managing the Preferred Networks list and 802.1X profiles (if your network uses 802.1X, such as a WPA Enterprise or WPA2 Enterprise network would).


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...