Skip to content

Instantly share code, notes, and snippets.

@myedibleenso
Forked from ryin/tmux_local_install.sh
Last active July 1, 2016 23:01
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 myedibleenso/54776f224f01ec6b5daa00e1a3674c09 to your computer and use it in GitHub Desktop.
Save myedibleenso/54776f224f01ec6b5daa00e1a3674c09 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 $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.2
LIBEVENT_VERSION=2.0.22
NCURSES_VERSION=5.9
M4_VERSION=1.4.17
AUTOMAKE_VERSION=1.12.2
AUTOCONF_VERSION=2.69
# destination
LOCAL_BIN=$HOME/local/bin
# create our directories
mkdir -p $LOCAL_BIN $HOME/tmux_tmp
cd $HOME/tmux_tmp
export PATH=$LOCAL_BIN:$PATH
# download source files for tmux, libevent, and ncurses
wget https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz
# get m4
wget ftp://ftp.gnu.org/gnu/m4/m4-${M4_VERSION}.tar.gz
# get automake
wget ftp://ftp.gnu.org/gnu/automake/automake-${AUTOMAKE_VERSION}.tar.gz
# get autoconf
wget http://ftp.gnu.org/gnu/autoconf/autoconf-${AUTOCONF_VERSION}.tar.gz
# assume stable release
wget https://github.com/libevent/libevent/releases/download/release-${LIBEVENT_VERSION}-stable/libevent-${LIBEVENT_VERSION}-stable.tar.gz
# get ncurses
wget ftp://ftp.gnu.org/gnu/ncurses/ncurses-${NCURSES_VERSION}.tar.gz
# extract files, configure, and compile
############
# m4 #
############
tar xvzf m4-${M4_VERSION}.tar.gz
cd m4-${M4_VERSION}
./configure --prefix=$HOME/local
make
make install
cd ..
############
# autoconf #
############
tar xvzf autoconf-${AUTOCONF_VERSION}.tar.gz
cd autoconf-${AUTOCONF_VERSION}
./configure --prefix=$HOME/local
make
make install
cd ..
############
# automake #
############
tar xvzf automake-${AUTOMAKE_VERSION}.tar.gz
cd automake-${AUTOMAKE_VERSION}
./configure --prefix=$HOME/local
make
make install
cd ..
############
# libevent #
############
tar xvzf libevent-${LIBEVENT_VERSION}-stable.tar.gz
cd libevent-${LIBEVENT_VERSION}-stable
./configure --prefix=$HOME/local
make
make install
cd ..
############
# ncurses #
############
tar xvzf ncurses-${NCURSES_VERSION}.tar.gz
cd ncurses-${NCURSES_VERSION}
./configure --prefix=$HOME/local
make
make install
cd ..
############
# tmux #
############
tar xvzf tmux-${TMUX_VERSION}.tar.gz
cd tmux-${TMUX_VERSION}
./configure CFLAGS="-I$HOME/local/include -I$HOME/local/include/ncurses" LDFLAGS="-L$HOME/local/lib -L$HOME/local/include/ncurses -L$HOME/local/include"
CPPFLAGS="-I$HOME/local/include -I$HOME/local/include/ncurses" LDFLAGS="-static -L$HOME/local/include -L$HOME/local/include/ncurses -L$HOME/local/lib" make
cp tmux $LOCAL_BIN
cd ..
# cleanup
rm -rf $HOME/tmux_tmp
echo "$HOME/local/bin/tmux is now available. You can optionally add $LOCAL_BIN to your PATH."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment