Skip to content

Instantly share code, notes, and snippets.

@wckdouglas
Created January 12, 2016 16:41
Show Gist options
  • Save wckdouglas/0e7f0094448977183ad4 to your computer and use it in GitHub Desktop.
Save wckdouglas/0e7f0094448977183ad4 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 $INSTALLPATH/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
INSTALLPATH=$(pwd)
# create our directories
mkdir -p $INSTALLPATH/local $INSTALLPATH/tmux_tmp
cd $INSTALLPATH/tmux_tmp
# download source files for tmux, libevent, and ncurses
git clone https://github.com/tmux/tmux.git
git clone https://github.com/libevent/libevent.git
git clone https://github.com/gittup/ncurses.git
# extract files, configure, and compile
############
# libevent #
############
cd libevent #-2.0.19-stable
pwd
./autogen.sh
./configure --prefix=$INSTALLPATH/local --disable-shared
make
make install
cd ..
############
# ncurses #
############
cd ncurses
pwd
./configure --prefix=$INSTALLPATH/local
make
make install
cd ..
############
# tmux #
############
cd tmux
./autogen.sh
./configure CFLAGS="-I$INSTALLPATH/local/include -I$INSTALLPATH/local/include/ncurses" LDFLAGS="-L$INSTALLPATH/local/lib -L$INSTALLPATH/local/include/ncurses -L$INSTALLPATH/local/include"
CPPFLAGS="-I$INSTALLPATH/local/include -I$INSTALLPATH/local/include/ncurses" LDFLAGS="-static -L$INSTALLPATH/local/include -L$INSTALLPATH/local/include/ncurses -L$INSTALLPATH/local/lib" make
cp tmux $INSTALLPATH/local/bin
cd ..
# cleanup
rm -rf $INSTALLPATH/tmux_tmp
echo "$INSTALLPATH/local/bin/tmux is now available. You can optionally add $INSTALLPATH/local/bin to your PATH."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment