Skip to content

Instantly share code, notes, and snippets.

@eromoe
Forked from djnugent/install_tmux.sh
Last active January 16, 2019 03:14
Show Gist options
  • Save eromoe/b93a2c14760588f38d3b14d3cd49216f to your computer and use it in GitHub Desktop.
Save eromoe/b93a2c14760588f38d3b14d3cd49216f to your computer and use it in GitHub Desktop.
Install Tmux locally
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $INSTALL_DIR/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.8
# INSTALL_DIR=$HOME
INSTALL_DIR=/usr
# create our directories
mkdir -p $INSTALL_DIR/local $INSTALL_DIR/tmux_tmp
cd $INSTALL_DIR/tmux_tmp
# download source files for tmux, libevent, and ncurses
wget -O tmux-${TMUX_VERSION}.tar.gz https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
wget http://invisible-island.net/datafiles/release/ncurses.tar.gz
# extract files, configure, and compile
############
# libevent #
############
tar xvzf libevent-2.1.8-stable.tar.gz
cd libevent-2.1.8-stable
./configure --prefix=$INSTALL_DIR/local --disable-shared
make
make install
cd ..
############
# ncurses #
############
tar xvzf ncurses.tar.gz
cd ncurses-*
./configure --prefix=$INSTALL_DIR/local
make
make install
cd ..
############
# tmux #
############
tar xvzf tmux-${TMUX_VERSION}.tar.gz
cd tmux-${TMUX_VERSION}
./configure CFLAGS="-I$INSTALL_DIR/local/include -I$INSTALL_DIR/local/include/ncurses" LDFLAGS="-L$INSTALL_DIR/local/lib -L$INSTALL_DIR/local/include/ncurses -L$INSTALL_DIR/local/include"
CPPFLAGS="-I$INSTALL_DIR/local/include -I$INSTALL_DIR/local/include/ncurses" LDFLAGS="-static -L$INSTALL_DIR/local/include -L$INSTALL_DIR/local/include/ncurses -L$INSTALL_DIR/local/lib" make
cp tmux $INSTALL_DIR/local/bin
cd ..
# cleanup
rm -rf $INSTALL_DIR/tmux_tmp
echo "$INSTALL_DIR/local/bin/tmux is now available. You can optionally add $INSTALL_DIR/local/bin to your PATH."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment