Skip to content

Instantly share code, notes, and snippets.

@ccaspers
Forked from ryin/tmux_local_install.sh
Last active July 11, 2016 16:28
Show Gist options
  • Save ccaspers/be58f3378d2203c6746077df44111c9f to your computer and use it in GitHub Desktop.
Save ccaspers/be58f3378d2203c6746077df44111c9f to your computer and use it in GitHub Desktop.
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $APP_DIR/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.2
APP_DIR=$HOME/.local
TMP_DIR=$HOME/tmux_tmp
# create our directories
mkdir -p $APP_DIR $TMP_DIR
cd $TMP_DIR
# 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/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz
wget https://ftp.gnu.org/gnu/ncurses/ncurses-5.9.tar.gz
# extract files, configure, and compile
############
# libevent #
############
tar xvzf libevent-2.0.19-stable.tar.gz
cd libevent-2.0.19-stable
./configure --prefix=$APP_DIR --disable-shared
make
make install
cd ..
############
# ncurses #
############
tar xvzf ncurses-5.9.tar.gz
cd ncurses-5.9
./configure --prefix=$APP_DIR
make
make install
cd ..
############
# tmux #
############
tar xvzf tmux-${TMUX_VERSION}.tar.gz
cd tmux-${TMUX_VERSION}
./configure CFLAGS="-I$APP_DIR/include -I$APP_DIR/include/ncurses" LDFLAGS="-L$APP_DIR/lib -L$APP_DIR/include/ncurses -L$APP_DIR/include"
CPPFLAGS="-I$APP_DIR/include -I$APP_DIR/include/ncurses" LDFLAGS="-static -L$APP_DIR/include -L$APP_DIR/include/ncurses -L$APP_DIR/lib" make
cp tmux $APP_DIR/bin
cd ..
# cleanup
rm -rf $TMP_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment