Skip to content
Create a gist now

Instantly share code, notes, and snippets.

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=1.8
# create our directories
mkdir -p $HOME/local $HOME/tmux_tmp
cd $HOME/tmux_tmp
# download source files for tmux, libevent, and ncurses
wget -O tmux-${TMUX_VERSION}.tar.gz http://sourceforge.net/projects/tmux/files/tmux/tmux-${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz/download
wget https://github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz
wget ftp://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=$HOME/local --disable-shared
make
make install
cd ..
############
# ncurses #
############
tar xvzf ncurses-5.9.tar.gz
cd ncurses-5.9
./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 $HOME/local/bin
cd ..
# cleanup
rm -rf $HOME/tmux_tmp
echo "$HOME/local/bin/tmux is now available. You can optionally add $HOME/local/bin to your PATH."
@adibis

Oh - thank you, thank you, thank you. They only had screen at work. Now I can use tmux and be happy :)

@prinny

Thank you! This worked perfectly for me.

@jeffdonahue

Thanks so much, installed perfectly right out of the box. I hate having to figure out what libraries I need and where to get them for local installs, this saved me probably hours of pain (or from just continuing to use screen on machines I don't have root access for)...

@haridsv

I modified it to link statically and the resultant binary worked on a different system with different libc: https://gist.github.com/haridsv/5040047

@shime

Thanks!

Forked this and made it more customizable, updated versions of installed components and provided auto-install command.

Check it out at https://gist.github.com/shime/5706655.

@gundamew

Thank you for this script. Clearly and really helped.

@ZeroDragon

Worked on BLUEHOST.com just FYI

@matschaffer

Oh man, thanks for this. So much time savings.

@hv15

Thanks :)

@SteveLTN

Thank you so much! I got an ssh account to a cluster from my university, but it doesn't have Tmux installed. Now with your script, my life is much easier!

@bodypheo

You are a king among men. ;) Kudos to you-

@jfmercer

Many, many, many thanks for this.

@joshterrell805

Brilliant! thank you

@WillXu

so brilliant! 

@zephraph

Fantastic, thanks!

@jingz

awesome thanks!

@endrebak

Thanks! Cannot stand screen. Now to waste some hours trying to understand why what I tried failed...

@pedrormjunior

Thanks!

@andrewdalecramer

At the risk of repeated others, thanks so much for this! I've used it as a base to install Vim and tig as well. For the life of me couldn't figure out how to do it before now!

@luyifan

thanks

@dsfcode

This is awesome, thanks so much! We only have screen at work so getting tmux was a must.

@jiacai2050

I met a problem when exec
wget https://github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz

--2014-10-23 11:08:44-- https://github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz
Resolving github.com... 192.30.252.128
Connecting to github.com|192.30.252.128|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://cloud.github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz [following]
--2014-10-23 11:08:46-- https://cloud.github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz
Resolving cloud.github.com... 54.230.125.200, 205.251.212.199, 54.230.126.47, ...
Connecting to cloud.github.com|54.230.125.200|:443... connected.
OpenSSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
Unable to establish SSL connection.

my os is centos6.5 64bit

@bouthilx

I had the same problem. I manually downloaded libevent-2.0.19-stable.tar.gz and then everything worked fine.

@chu-NMSU

Thanks.

@mnsmar

Got the following error:
tmux: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory

Had to:
export LD_LIBRARY_PATH=/path/to/my/home/local/lib/:${LD_LIBRARY_PATH}

@aarobc

@jiacai2050 change the
wget
to:
curl -L -O

@pictodroid

with curl -L -O I'm getting error SSL routines: SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
with curl -O I can download something but is not a tar ball

@texzhichen

Very useful shell script, thank you!

@ghost
Unknown commented

Excellent, thank you!

@calebjones

Works great!

@ysangkok

Shouldn't it be -L$HOME/local/lib/ncurses instead of -L$HOME/local/include/ncurses ?

@thomasfrivold

This worked perfectly on Inmotion.com shared server.

@bmyerz

thanks

@bmyerz

thanks, worked on redhat 4.4 fine

@chilicuil

Other alternative could be to fetch the static binary with static-get, no compiler required =)

sh <(wget -qO- s.minos.io/s) -x tmux-2.0

To list all available versions:

sh <(wget -qO- s.minos.io/s) -s -v tmux

https://github.com/minos-org/minos-static

@chilicuil

Other alternative could be to fetch the static binary with static-get, no compiler required =)

sh <(wget -qO- s.minos.io/s) -x tmux-2.0

To list all available versions:

sh <(wget -qO- http://s.minos.io/s) -s -v tmux

https://github.com/minos-org/minos-static

@chilicuil

Other alternative could be to fetch the static binary with static-get, no compiler required =)

sh <(wget -qO- http://s.minos.io/s) -x tmux-2.0

To list all available versions:

sh <(wget -qO- http://s.minos.io/s) -s -v tmux

https://github.com/minos-org/minos-static

@chilicuil

Other alternative could be to fetch the static binary with static-get, no compiler required =)

sh <(wget -qO- http://s.minos.io/s) -x tmux-2.0

To list all available versions:

sh <(wget -qO- http://s.minos.io/s) -v -s tmux

https://github.com/minos-org/minos-static

@kedare

The WGET SSL error is due to an old version of wget not supporting SNI, just replace the line that download libevent source by this one :

curl https://cloud.github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz > libevent-2.0.19-stable.tar.gz
@KDGNOR

mathieupoussin thx u fix ssl error i got :+1:

@luiarthur

This is great!

@jealie

Awesome script!

I forked it to use automatically the latest version of tmux (currently version 2.1) from the github repo: https://github.com/jealie/install_tmux

This version relies on git to fetch the source, which also solves the SSL error some people had.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.