4

I can connect/disconnect using the Tunnelblick app. How do I connect via the command line?

/Applications/Tunnelblick.app/Contents/Resources/openvpnstart start ???

How do I determine the parameters to pass?

  • As @Mikey T.K. said, it would be easier to control it with apple script, you can see the dictionary to see all commands. You directly run openvpn but then you might miss a option or something. I have a LaunchBar Action to control VPN with that, if you're interested. – user14492 Jul 30 '15 at 20:27
  • @user14492 you mean something like this? github.com/hlissner/lb6-actions/tree/master/VPN.lbaction/… – lucianf Aug 1 '16 at 14:38
  • @lucianf Yep that's the one! Can't believe you actually found it. :P – user14492 Aug 1 '16 at 15:59
7

A possibly better idea than messing around with openvpn directly (Tunnelblick is basically just a fancy GUI around it) would be to use an Applescript, something that can definitely be launched from the terminal (i.e. with osascript)

Example taken from here:

tell application "Tunnelblick"
    connect "Company_VPN"
    get state of first configuration where name = "Company_VPN"
    repeat until result = "CONNECTED"
        delay 1
        get state of first configuration where name = "Company_VPN"
    end repeat
end tell

You'd write this into the Script Editor, save it, and then you could launch it from the terminal with osascript, or by double clicking on the script.

  • 1
    Use the AppleScript Editor to save to connect.scpt and run with osascript connect.scpt – Brian Low Aug 6 '15 at 17:48
  • Probably should have mentioned that the first time. Thanks, updated. – Mikey T.K. Jan 24 '16 at 17:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .