OpenVPN on Mac OS X

If you need OpenVPN on your Mac, and you don’t want to pay for OpenVPN applications, you can compile everything for your own.

1. Get OpenVPN for OS X

You can download OpenVPN, for free, from page:

https://codeload.github.com/OpenVPN/openvpn/zip/master

2. Get LZO library

Download LZO sources from

http://www.oberhumer.com/opensource/lzo/download/lzo-2.09.tar.gz

3. Get tuntap for OS X

Download installation/sources from

http://downloads.sourceforge.net/tuntaposx/tuntap_20150118.tar.gz

You can also build tuntap from the source code

git clone git://tuntaposx.git.sourceforge.net/gitroot/tuntaposx/tuntaposx

4. Compile LZO

Create place for building all the stuff and build LZO (make sure to install XCode before you proceed). XCode can be downloaded here: XCode

If you want to execute anything in terminal, you have two choices: use built-in Terminal app (Applications -> Utilities -> Terminal) or download and install iTerm2 (that’s my preferred terminal application). You can download iTerm2 from here: https://www.iterm2.com

mkdir -p ~/opt/lzo
./configure --prefix=$HOME/opt/lzo
make
make install

5. Compile OpenVPN

mkdir -p ~/opt/openvpn

export CFLAGS="-I/Applications/Xcode.app/Contents/Developer\
/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdk/MacOSX.sdk/usr/include\
 -I$HOME/opt/lzo/include"
export LDFLAGS="-L$HOME/opt/lzo/lib/"

./configure --prefix=$HOME/opt/openvpn

make
make install

6. Load yuntap extentions and run OpenVPN with configuration provided by your sys admin.

sudo kextload /Library/Extensions/tap.kext
sudo kextload /Library/Extensions/tun.kext
sudo openvpn config.ovpn