Building tmux on OS X

You will need:

libevent-2.0.22 – link
openssl – https://github.com/openssl/openssl.git
tmux – https://tmux.github.io

# at first, compile and install openssl
git clone https://github.com/openssl/openssl.git
cd openssl
./config --prefix=$HOME/opt/usr
make; make install

# then, compile and install libevent
curl https://github.com/libevent/libevent/releases/download/\
release-2.0.22-stable/libevent-2.0.22-stable.tar.gz\
 -O libevent-2.0.22-stable.tar.gz

tar zxf libevent-2.0.22-stable.tar.gz
mv libevent-2.0.22-stable libevent
cd libevent

# Note, you may experience some issues when using OpenSSL above. 
# In that case, use one delivered
# together with OS X development env
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"
./configure --prefix=/Users/michalo/opt/usr/
make; make install

# get tmux and build it
# if you prefer, you can use development version instead
# git clone https://github.com/tmux/tmux.git
curl https://github.com/tmux/tmux/releases/\
download/2.2/tmux-2.2.tar.gz -O tmux-2.2.tar.gz
tar zxf tmux-2.2.tar.gz
cd tmux-2.2

# as above, it might be that you will need system wide libs and includes
# note that we are using $HOME/opt/usr/include
# this is the place where libevent was installed
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 $HOME/opt/usr/include"

# this time, we have to point to libs as well (libevent again)
export LDFLAGS="-L$HOME/opt/usr/lib"
./configure --prefix=/Users/michalo/opt/usr/
make; make install

Now, you are ready to go.