Skip to content

Instantly share code, notes, and snippets.

@mindscratch
Forked from shime/_readme.md
Created September 26, 2013 12:15
Show Gist options
  • Save mindscratch/6713336 to your computer and use it in GitHub Desktop.
Save mindscratch/6713336 to your computer and use it in GitHub Desktop.

Having trouble installing the latest stable version of tmux?

Save yourself some time and run this little fellow!

Prerequisities

  • gcc
  • wget

Installs

  • tmux - 1.8 (latest stable)
  • libevent - 2.0.21 (latest stable)
  • ncurses - 5.9 (latest stable)

How to install

curl -fsSL https://gist.github.com/shime/5706655/raw/install.sh | sudo bash -e
#!/bin/bash
# Script for installing tmux and dependencies.
# tmux will be installed in /usr/local/lib by default.
# Prerequisites: - gcc
# - wget
# define versions
tmux_version="1.8"
libevent_version="2.0.21"
ncurses_version="5.9"
tmux_name="tmux-$tmux_version"
libevent_name="libevent-$libevent_version-stable"
ncurses_name="ncurses-$ncurses_version"
# set the installation directory
target_dir="/usr/local"
# download source files for tmux, libevent, and ncurses
# save them in /tmp
cd /tmp
wget -O $tmux_name.tar.gz http://sourceforge.net/projects/tmux/files/tmux/$tmux_name/$tmux_name.tar.gz/download
wget -O $libevent_name.tar.gz https://github.com/downloads/libevent/libevent/$libevent_name.tar.gz
wget -O $ncurses_name.tar.gz ftp://ftp.gnu.org/gnu/ncurses/$ncurses_name.tar.gz
# extract files, configure, and compile
# libevent installation
tar xvzf $libevent_name.tar.gz
cd $libevent_name
./configure --prefix=$target_dir --disable-shared
make
make install
cd -
# ncurses installation
tar xvzf $ncurses_name.tar.gz
cd $ncurses_name
./configure --prefix=$target_dir
make
make install
cd -
# tmux installation
tar xvzf $tmux_name.tar.gz
cd $tmux_name
./configure CFLAGS="-I$target_dir/include -I$target_dir/include/ncurses" LDFLAGS="-L$target_dir/lib -L$target_dir/include/ncurses -L$target_dir/include"
CPPFLAGS="-I$target_dir/include -I$target_dir/include/ncurses" LDFLAGS="-static -L$target_dir/include -L$target_dir/include/ncurses -L$target_dir/lib" make
cp tmux $target_dir/bin
cd -
echo
echo "//////////////////////////////////////////////////////////"
echo "Post installation message:"
echo "----------------------------------------------------------"
echo "Installed tmux v$tmux_version with success! \o/"
echo
echo "Hit 'tmux -V' to make sure you're using the right version."
echo "//////////////////////////////////////////////////////////"
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment