Skip to content

Instantly share code, notes, and snippets.

@brock
Last active December 10, 2015 14:18
Show Gist options
  • Save brock/4446242 to your computer and use it in GitHub Desktop.
Save brock/4446242 to your computer and use it in GitHub Desktop.
A function to start the OSX VPN from the command line. Just modify "My VPN Name" to the name you have in Network Preferences. Then from the command line run: vpn.
# place this with other bash functions in either ~/.bash_profile or a similar location
vpn () {
/usr/bin/env osascript <<EOF
tell application "System Events"
tell current location of network preferences
set VPN to service "My VPN Name"
if exists VPN then connect VPN
end tell
end tell
EOF
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment