Skip to content

Instantly share code, notes, and snippets.

@uranusjr
Created October 16, 2012 21:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uranusjr/3902309 to your computer and use it in GitHub Desktop.
Save uranusjr/3902309 to your computer and use it in GitHub Desktop.
Connect to specified SSID via Terminal on Mac OS X
set interface to "enXX" # 把它換成你的無線網卡編號
set ssid to "" # 填入你想連接網路的 SSID
set passwd to (text returned of (display dialog "Enter password:" default answer "" with hidden answer))
do shell script "networksetup -setairportnetwork " & interface & " " & (quoted form of ssid) & " " & (quoted form of passwd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment