Connect to an AirPort Network via the Command Line in Mac OS X

May 27, 2010 - Leave a Comment

You can connect to any wireless network from the command line by using the networksetup command as follows:
sudo networksetup -setairportnetwork en1 SSID PASSWORD

So in a practical example, let’s say we are connecting to a network named ‘Wireless’ and the password is set to ‘macsrule’ as so:
sudo networksetup -setairportnetwork en1 Wireless macsrule

As far as I know this is Snow Leopard only, but it may work on older versions of Mac OS X as well. You can read more about the networksetup command line tool on it’s Apple.com Manual Page

Related articles:

Posted by: David Mendez in Command Line

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

OSXDaily on Facebook

OSXDaily on Google+

Shop at Amazon

Ad

Shared on Facebook