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, 2015 at 20:27
  • @user14492 you mean something like this? github.com/hlissner/lb6-actions/tree/master/VPN.lbaction/…
    – lucianf
    Aug 1, 2016 at 14:38
  • @lucianf Yep that's the one! Can't believe you actually found it. :P
    – user14492
    Aug 1, 2016 at 15:59

2 Answers 2


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.

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

The simplest solution is to use tunblkctl. It's lightweight and gets the job done. You can quickly install it using Homebrew and then utilize it for various OpenVPN-related automation workflows on macOS.

Disclosure: I am the author.

You must log in to answer this question.

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