Installing tmux on OSX

Installing tmux, a great terminal multiplexer, is very easy, and takes less than five minutes. For a brief introduction to tmux, check out the previous post and this page. Below are instructions for manually installing tmux 2.1 on OSX, but since March 2016 it is also possible to use

brew install tmux

to install tmux 2.1.

A tmux.conf file can be downloaded here and copied to ~/.tmux.conf, or one can use:

wget -O ~/.tmux.conf

This version of the tmux.conf file has options for the function keys F6, F7 and F8 to be shortcuts for compiling LaTeX, and includes shortcuts for tmux-resurrect Another version of the file which has these options commented out is::

wget -O ~/.tmux.conf

Below are instructions for installing manually, but they are not needed anymore.

Step 1: Make a build directory

It is useful to have a folder...

mkdir ~/tmuxbuild
cd ~/tmuxbuild 

Step 2: Download tmux

Go to and right-click-Save-as on the 'Download tmux-2.1' link (at the time of writing 2.1 is the most recent version).

Save the file, tmux-2.1.tar.gz, to the recently created ~/tmuxbuild folder.

Step 2: Download libevent

libevent is an event notification library that tmux uses, but needs to be downloaded separately. libevent and right-click-Save-as on the latest version listed under 'Download-Stable releases' link (at the time of writing libevent-2.0.22-stable.tar.gz), and also save this file to ~/tmuxbuild.

That concludes all the downloading. Only a couple of command-line commands, and tmux will be installed!

Step 3: Unpack tarballs

In the terminal,

cd ~/tmuxbuild
tar xzf libevent-2.0.22-stable.tar.gz
tar xzf tmux-2.1.tar.gz

(Optional) Since they are not needed anymore, you can remove them:

rm *.gz

Step 4: Make and install libevent

cd libevent-2.0.22-stable
./configure && make

and now do a sudo install (you'll need the admin password):

sudo make install

Step 4: Make and install tmux

Pretty much the same.

cd ~/tmuxbuild/tmux-2.1
./configure && make

and again do a sudo install (you'll need the admin password):

sudo make install

Check your tmux version

In a terminal:

tmux -V

(capital 'V'). Should see

tmux 2.1

And that's it!


tmux 1.8?

If tmux -V returns another version, e.g. tmux 1.8, then the tmux command is bound to that earlier version. You might see this if you are installing a local version on a server. No problem, it can easily be fixed by editing the ~/.bashrc (Linux) or ~/.bash_profile (OSX):

vim ~/.bashrc

and then modifiying PATH:

export PATH=~/tmuxbuild/tmux-2.1:$PATH

which basically just makes the terminal search for the tmux command in the install folder.

tmux not found?

If tmux -V results in an error message saying tmux is not found, then sadly the install did not work. These instructions above are heavily based on Unix Ben's instructions. However, those instructions, which were written a few years ago, went through the extra effort of setting certain flags. With the versions of tmux and libevent used above, I did not need to use these flags (when installing on OSX). However, if you run into difficulties, perhaps try setting the flags as per the older instructions.

Can't I just use brew install?

Installing tmux automatically using brew install on Mac may lead to an earlier version (e.g. 2.0) being installed. One of the great features of tmux 2.1 is the window-style command, which allows inactive panes to be dimmed - more on this in the following posts.

Update: according to a comment in this post, since March 2016 brew install tmux installs tmux 2.1.

Using tmux-resurrect

If you want to be able to save your tmux sessions (in case you need to restart your computer), check out this post, which talks about tmux-resurrect.