Skip to content

Instantly share code, notes, and snippets.

@smsharma
Last active October 25, 2024 21:39
Show Gist options
  • Save smsharma/0003b61a571cab63ad80 to your computer and use it in GitHub Desktop.
Save smsharma/0003b61a571cab63ad80 to your computer and use it in GitHub Desktop.
Install tmux locally without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $INSTALL_DIR/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=1.8
INSTALL_DIR=/group/hepheno/smsharma
# create our directories
mkdir -p $INSTALL_DIR/local $INSTALL_DIR/tmux_tmp
cd $INSTALL_DIR/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=$INSTALL_DIR/local --disable-shared
make
make install
cd ..
############
# ncurses #
############
tar xvzf ncurses-5.9.tar.gz
cd ncurses-5.9
./configure --prefix=$INSTALL_DIR/local
make
make install
cd ..
############
# tmux #
############
tar xvzf tmux-${TMUX_VERSION}.tar.gz
cd tmux-${TMUX_VERSION}
./configure CFLAGS="-I$INSTALL_DIR/local/include -I$INSTALL_DIR/local/include/ncurses" LDFLAGS="-L$INSTALL_DIR/local/lib -L$INSTALL_DIR/local/include/ncurses -L$INSTALL_DIR/local/include"
CPPFLAGS="-I$INSTALL_DIR/local/include -I$INSTALL_DIR/local/include/ncurses" LDFLAGS="-static -L$INSTALL_DIR/local/include -L$INSTALL_DIR/local/include/ncurses -L$INSTALL_DIR/local/lib" make
cp tmux $INSTALL_DIR/local/bin
cd ..
# cleanup
rm -rf $INSTALL_DIR/tmux_tmp
echo "$INSTALL_DIR/local/bin/tmux is now available. You can optionally add $HOME/local/bin to your PATH."
@mohammed1x
Copy link

mkdir: cannot create directory ‘/group’: Permission denied
mkdir: cannot create directory ‘/group’: Permission denied

@sidfeels
Copy link

sidfeels commented Aug 1, 2024

mkdir: cannot create directory ‘/group’: Permission denied mkdir: cannot create directory ‘/group’: Permission denied

use home directory instead. if you run this you'll probably get that error.... change it bit in this part INSTALL_DIR=$HOME/tmux_local depending on where your home dir is

@luccachiang
Copy link

URL transformed to HTTPS due to an HSTS policy
--2024-10-25 14:42:53--  https://sourceforge.net/projects/tmux/files/tmux/tmux-1.8/tmux-1.8.tar.gz/download
Resolving sourceforge.net (sourceforge.net)... 172.64.150.145, 104.18.37.111, 2606:4700:4400::ac40:9691, ...
Connecting to sourceforge.net (sourceforge.net)|172.64.150.145|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://sourceforge.net/projects/tmux.mirror/ [following]
--2024-10-25 14:42:53--  https://sourceforge.net/projects/tmux.mirror/
Reusing existing connection to sourceforge.net:443.
HTTP request sent, awaiting response... 200 OK
Length: 103244 (101K) [text/html]
Saving to: ‘tmux-1.8.tar.gz’

tmux-1.8.tar.gz                                                           100%[==================================================================================================================================================================================>] 100.82K  --.-KB/s    in 0.01s   

2024-10-25 14:42:53 (8.34 MB/s) - ‘tmux-1.8.tar.gz’ saved [103244/103244]

--2024-10-25 14:42:53--  https://github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz
Resolving github.com (github.com)... 140.82.116.3
Connecting to github.com (github.com)|140.82.116.3|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-10-25 14:42:53 ERROR 404: Not Found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment