Skip to content

Instantly share code, notes, and snippets.

@gnachman
Forked from todgru/_readme.md
Last active August 29, 2015 14:21
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 gnachman/21b6453986b228970e7a to your computer and use it in GitHub Desktop.
Save gnachman/21b6453986b228970e7a to your computer and use it in GitHub Desktop.
#!/bin/bash
# Based on this: http://blennd.com/post/the-pains-of-installing-tmux-on-a-shared-server/
# Script forked from https://gist.github.com/shime/5706655/
# Script for installing tmux and dependencies.
# tmux will be executable from ~/local/lib.
# Prerequisites: - gcc
# - wget
# define versions
tmux_version="2.0"
libevent_version="2.0.21"
tmux_name="tmux-$tmux_version"
libevent_name="libevent-$libevent_version-stable"
# set the installation directory
target_dir="~/local/bin"
# Create working directories
mkdir -p ~/local
mkdir -p ~/temp
# download source files for tmux, libevent
# save them in ~/temp
cd ~/temp
wget -O $tmux_name.tar.gz http://sourceforge.net/projects/tmux/files/tmux/$tmux_name/$tmux_name.tar.gz/download
wget -O $libevent_name.tar.gz https://github.com/downloads/libevent/libevent/$libevent_name.tar.gz
# extract files, configure, and compile
# libevent installation
tar xvzf $libevent_name.tar.gz
cd $libevent_name
./configure --prefix=$HOME/local
make
make install
cd -
# tmux installation
tar xvzf $tmux_name.tar.gz
cd ../$tmux_name
DIR="$HOME/local"
./configure CFLAGS="-I$DIR/include" LDFLAGS="-L$DIR/lib"
make
cp tmux $target_dir/bin
cd -
# Add path to .bashrc
echo 'export PATH=$HOME/local/bin:$PATH' >> .bashrc
echo 'export LD_LIBRARY_PATH="$HOME/local/lib"' >> .bashrc
cd ~
source ~/.bashrc
echo
echo "//////////////////////////////////////////////////////////"
echo "Post installation message:"
echo "----------------------------------------------------------"
echo "Installed tmux v$tmux_version with success! \o/"
echo
echo "Hit 'tmux -V' to make sure you're using the right version."
echo "//////////////////////////////////////////////////////////"
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment