Skip to content

Instantly share code, notes, and snippets.

@mackjoner
Forked from rschuman/install_tmux_centos.md
Created February 15, 2017 10:08
Show Gist options
  • Save mackjoner/81f7199ebffc0728794ce8ad57ddc4fd to your computer and use it in GitHub Desktop.
Save mackjoner/81f7199ebffc0728794ce8ad57ddc4fd to your computer and use it in GitHub Desktop.
Installation of most recent libevent2 and tmux on CentOS. Compile flags borrowed from https://gist.github.com/sturadnidge/4185338

Dependencies:

Downloads:

Yum Packages:

  • gcc
  • kernel-devel
  • make
  • ncurses-devel

Installation for all Users

Download the latest libevent2 and tmux:

$ sudo su -
$ mkdir ~/downloads && cd ~/downloads
$ curl http://sourceforge.net/projects/levent/files/latest/download?source=files -L -o libevent2.tar.gz -w 'Last URL was: %{url_effective}'
$ curl http://sourceforge.net/projects/tmux/files/latest/download?source=files -L -o tmux.tar.gz -w 'Last URL was: %{url_effective}'

Install dependencies:

$ yum install gcc kernel-devel make ncurses-devel

Compile libevent:

$ cd ~/downloads
$ tar zxvf libevent2.tar.gz
$ cd /libevent-2.x.xx-stable
$ ./configure --prefix=$HOME/local
$ make
$ make install

Compile tmux:

$ cd ~/downloads
$ tar zxvf tmux.tar.gz
$ cd tmux-n.n
$ LDFLAGS="-L/usr/local/lib -Wl,-rpath=/usr/local/lib" ./configure --prefix=/usr/local
$ make
$ make install

Installation for a Single User

Download the latest libevent2 and tmux:

$ sudo su - <user_name>
$ mkdir ~/local # local folder for libevent, tmux dependencies, binaries, etc. 
$ mkdir ~/downloads && cd ~/downloads
$ curl http://sourceforge.net/projects/levent/files/latest/download?source=files -L -o libevent2.tar.gz -w 'Last URL was: %{url_effective}'
$ curl http://sourceforge.net/projects/tmux/files/latest/download?source=files -L -o tmux.tar.gz -w 'Last URL was: %{url_effective}'

Install dependencies (you will need sudo privileges):

$ sudo yum install gcc kernel-devel make ncurses-devel

Compile libevent:

$ cd ~/downloads
$ tar zxvf libevent2.tar.gz
$ cd /libevent-2.x.xx-stable
$ ./configure --prefix=$HOME/local
$ make
$ make install

Compile tmux:

$ cd ~/downloads
$ tar zxvf tmux.tar.gz
$ cd tmux-n.n

Configure: Add your newly compiled header in ~/local/lib to configuration parameters:

$ LDFLAGS="-L/usr/local/lib -L$HOME/local/lib -Wl,-rpath=/usr/local/lib:$HOME/local/lib" ./configure --prefix=$HOME/local

Makefile: This needs to be altered to include newly created files in ~/usr/local/include:

  • open vi with a search for "am_append_6 =": $ vi +/am__append_6\ = Makefile
  • change am__append_6 = -iquote. -I/usr/local/include to am__append_6 = -iquote. -I/usr/local/include -I$(prefix)/include
  • save and quit

Continue on as normal:

$ make
$ make install

According to the output, the executable has been installed to ~/local/bin:

make[1]: Entering directory `/home/robert/downloads/tmux-1.8'
 /bin/mkdir -p '/home/robert/local/bin'
  /usr/bin/install -c tmux '/home/robert/local/bin'
 /bin/mkdir -p '/home/robert/local/share/man/man1'
 /usr/bin/install -c -m 644 tmux.1 '/home/robert/local/share/man/man1'
make[1]: Leaving directory `/home/robert/downloads/tmux-1.8'

In case another version of tmux is already globally installed on the system, you might want to add the following line to your ~/.bashrc, ~/.zshrc, etc:

alias tmux=$HOME/local/bin/tmux

Reload your .bashrc/.zshrc/etc settings:

$ source ~/.bashrc

Make sure you're now pointing to the correct version of tmux:

$ tmux -V
>> tmux 1.n

Enabling Mouse Support

  • In your home folder, edit or create a .tmux.conf file.
  • Add the following settings to .tmux.conf:
# Enable mouse support (tested in iTerm)
set-window-option -g mode-mouse on
set-option -g mouse-select-pane on
set-option -g mouse-resize-pane on
set-option -g mouse-select-window on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment