Skip to content

Instantly share code, notes, and snippets.

@Wsine
Created November 13, 2018 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wsine/b016c6634a465051f24755c0e6a78342 to your computer and use it in GitHub Desktop.
Save Wsine/b016c6634a465051f24755c0e6a78342 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.1
LIBEVENT_VERSION=2.0.19
NCURSES_VERSION=5.9
# create our directories
mkdir -p /tmp/local /tmp/tmux_tmp
cd /tmp/tmux_tmp
# download source files for tmux, libevent, and ncurses
wget https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz
wget https://github.com/downloads/libevent/libevent/libevent-${LIBEVENT_VERSION}-stable.tar.gz
wget ftp://ftp.gnu.org/gnu/ncurses/ncurses-${NCURSES_VERSION}.tar.gz
# extract files, configure, and compile
############
# libevent #
############
tar xvzf libevent-${LIBEVENT_VERSION}-stable.tar.gz
cd libevent-${LIBEVENT_VERSION}-stable
./configure --prefix=/tmp/local --disable-shared
make
make install
cd ..
############
# ncurses #
############
tar xvzf ncurses-${NCURSES_VERSION}.tar.gz
cd ncurses-5.9
./configure --prefix=/tmp/local
make
make install
cd ..
############
# tmux #
############
tar xvzf tmux-${TMUX_VERSION}.tar.gz
cd tmux-${TMUX_VERSION}
./configure CFLAGS="-I/tmp/local/include -I/tmp/local/include/ncurses" LDFLAGS="-L/tmp/local/lib -L/tmp/local/include/ncurses -L/tmp/local/include"
CPPFLAGS="-I/tmp/local/include -I/tmp/local/include/ncurses" LDFLAGS="-static -L/tmp/local/include -L/tmp/local/include/ncurses -L/tmp/local/lib" make
cp tmux $HOME/bin
cd ..
echo "$HOME/bin/tmux is now available. You can optionally add $HOME/bin to your PATH."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment