What is tmux?

tmux is a “terminal multiplexer”, it enables a number of terminals (or windows) to be accessed and controlled from a single terminal. tmux is intended to be a simple, modern, BSD-licensed alternative to programs such as GNU screen. Read more.

Install the download, build and tmux dependencies

We can download package information from all configured sources:

$ sudo apt update

We need to install Git in order to download the latest version of tmux from the official repository:

$ sudo apt install -y git

In order to get the latest version of tmux, we’ll be compiling and installing the software from source. We need to satisfy the build and tmux dependencies so that we can compile the software. To do this, we can install the automake, build-essential, pkg-config, libevent-dev, libncurses5-dev packages:

$ sudo apt install -y automake
$ sudo apt install -y build-essential
$ sudo apt install -y pkg-config
$ sudo apt install -y libevent-dev
$ sudo apt install -y libncurses5-dev

Download, compile and install tmux

We need to choose the target directory where we’ll download tmux. Let’s download in the /tmp/tmux. Before downloading we need to try to remove /tmp/tmux to ensure that this directory isn’t busy:

$ rm -fr /tmp/tmux

Download tmux to /tmp/tmux:

$ git clone https://github.com/tmux/tmux.git /tmp/tmux

Go to the /tmp/tmux directory:

$ cd /tmp/tmux

Execute autogen.sh file:

$ sh autogen.sh

Configure and compile the tmux binaries:

$ ./configure && make

Install the binaries into the system:

$ sudo make install

Go back the previous directory:

$ cd -

We don’t need to keep the downloaded tmux binaries, so we can remove /tmp/tmux:

rm -fr /tmp/tmux

Successfully finishing all steps above we can use the latest tmux. Enjoy!

All steps together:

#!/usr/bin/env bash

sudo apt update

sudo apt install -y git

sudo apt install -y automake
sudo apt install -y build-essential
sudo apt install -y pkg-config
sudo apt install -y libevent-dev
sudo apt install -y libncurses5-dev

rm -fr /tmp/tmux

git clone https://github.com/tmux/tmux.git /tmp/tmux

cd /tmp/tmux

sh autogen.sh

./configure && make

sudo make install

cd -

rm -fr /tmp/tmux