Vinay Shastry's blog

Posted Thu 30 July 2009

openvpn on mac (CLI)

If you’ve used Tunnelblick, you know it has issues - multiple openvpn processes, or not starting up on boot etc.

So here’s how to install openvpn the CLI way that just works!

(You need macports installed)

Quit and remove Tunnelblick from startup (system preferences -> accounts -> login items)

sudo port install openvpn2 tuntaposx

sudo launchctl load -w /Library/LaunchDaemons/org.macports.tuntaposx.plist

Create /Library/LaunchDaemons/org.openvpn.plist as follows
(Note: edit the working directory and config file name to suit your needs)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>Label</key>
     <string>org.openvpn</string>
     <key>OnDemand</key>
     <false/>
     <key>Program</key>
     <string>/opt/local/sbin/openvpn2</string>
     <key>ProgramArguments</key>
     <array>
          <string>/opt/local/sbin/openvpn2</string>
          <string>--config</string>
          <string>client.conf</string>
     </array>
     <key>RunAtLoad</key>
     <true/>
     <key>TimeOut</key>
     <integer>90</integer>
     <key>WorkingDirectory</key>
     <string>/Users/shastry/Library/openvpn</string>
</dict>
</plist>

And then

sudo launchctl load -w /Library/LaunchDaemons/org.openvpn.plist

Finally, reboot!

Category: misc
Tags: ihatetunnelblick mac openvpn

Comments