Skip to content

Instantly share code, notes, and snippets.

@shrayasr
Last active July 17, 2023 14:45
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save shrayasr/8714601 to your computer and use it in GitHub Desktop.
Save shrayasr/8714601 to your computer and use it in GitHub Desktop.
[OBSOLETE] Install tmux on OSX WITHOUT brew
Check https://gist.github.com/devisions/004999452e95de9058de2edc1656ca04 for a more up to date version
# Create a directory
mkdir ~/tmux-install
cd ~/tmux-install
# Get the files
curl -OL http://downloads.sourceforge.net/tmux/tmux-1.5.tar.gz
curl -OL http://downloads.sourceforge.net/project/levent/libevent/libevent-2.0/libevent-2.0.16-stable.tar.gz
# Extract them
tar xzf tmux-1.5.tar.gz
tar xzf libevent-2.0.16-stable.tar.gz
# Compile libevent
cd libevent-2.0.16-stable
./configure --prefix=/opt
make
sudo make install
# Compile tmux
cd ../tmux-1.5
LDFLAGS="-L/opt/lib" CPPFLAGS="-I/opt/include" LIBS="-lresolv" ./configure --prefix=/opt
make
sudo make install
# Link it
ln -s /opt/bin/tmux /usr/bin/tmux
@Fi5t
Copy link

Fi5t commented Dec 28, 2016

I've made some useful changes this file.

  • updated version of tmux
  • changed symlink for "post-yosemite" os

See my fork

@borrougagnou
Copy link

borrougagnou commented May 7, 2017

Hi, I have a problem with OSX 10.12 Sierra...

the libevent depo has changed by:
"https://github.com/downloads/libevent/libevent/libevent-2.0.16-stable.tar.gz"
source: http://libevent.org/old-releases.html
because I have an error when I try install libevent with sourceforge...

and,
I have this error when I type "make"
bufferevent_openssl.c:60:10: fatal error: 'openssl/bio.h' file not found
#include <openssl/bio.h>
^
Have you an idea why?
Regards.

@doc-crowston
Copy link

doc-crowston commented May 8, 2017

I have this error when I type "make"
bufferevent_openssl.c:60:10: fatal error: 'openssl/bio.h' file not found
#include <openssl/bio.h>
^
Have you an idea why?

The openssl headers were removed from OSX in El Capitan.

@AlexKvazos
Copy link

To fix openssl headers when compiling libevent use this instead of ./configure prefix=/opt
./configure LDFLAGS='-L/usr/local/opt/openssl/lib' CPPFLAGS='-I/usr/local/opt/openssl/include' prefix=/opt

@dxps
Copy link

dxps commented Jun 20, 2017

Thanks for the script!

Here is below an updated version, including the latest releases of tmux and libevent (as of today, 2017-06-20), with a little more verbosity and small fixes.

It is working just fine on my system:

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.12.5
BuildVersion:	16F73
$

install_tmux_osx_no_brew.sh

## setup _________________________________

TMUX_VER=2.5
LIBEVENT_VER=2.1.8-stable
TEMP_COMPILE=~/tmux-temp-compile
COMMON_INSTALL_PREFIX=/opt
SYMLINK=/usr/local/bin/tmux

## _______________________________________

echo
echo ">>> Creating and using temporary dir ${TEMP_COMPILE} for downloading and compiling libevent and tmux ..."
echo

mkdir ${TEMP_COMPILE}
cd ${TEMP_COMPILE}

echo
echo ">>> Downloading the releases ..."
echo

curl -OL https://github.com/tmux/tmux/releases/download/${TMUX_VER}/tmux-${TMUX_VER}.tar.gz
curl -OL https://github.com/libevent/libevent/releases/download/release-${LIBEVENT_VER}/libevent-${LIBEVENT_VER}.tar.gz

echo
echo ">>> Extracting tmux ${TMUX_VER} and libevent ${LIBEVENT_VER} ..."
echo

tar xzf tmux-${TMUX_VER}.tar.gz
tar xzf libevent-${LIBEVENT_VER}.tar.gz

echo
echo ">>> Compiling libevent ..."
echo

cd libevent-${LIBEVENT_VER}
./configure --prefix=${COMMON_INSTALL_PREFIX}
sudo make
sudo make install

echo
echo ">>> Compiling tmux ..."
echo

cd ../tmux-${TMUX_VER}
LDFLAGS="-L${COMMON_INSTALL_PREFIX}/lib" CPPFLAGS="-I${COMMON_INSTALL_PREFIX}/include" LIBS="-lresolv" ./configure --prefix=${COMMON_INSTALL_PREFIX}
make
echo
echo ">>> Installing tmux in ${COMMON_INSTALL_PREFIX}/bin ..."
echo

sudo make install

echo
echo ">>> Symlink to it from ${SYMLINK} ..."
sudo ln -s ${COMMON_INSTALL_PREFIX}/bin/tmux ${SYMLINK}

echo
echo ">>> Cleaning up by removing the temporary dir ${TEMP_COMPILE} ..."
echo

cd ..
sudo rm -rf ${TEMP_COMPILE}

@balain
Copy link

balain commented Jun 30, 2017

Thanks for these scripts. Very helpful!

@acruzpr
Copy link

acruzpr commented Sep 6, 2017

Thanks!!!

Very useful!!

@jnovack
Copy link

jnovack commented Nov 12, 2019

@DEVisions is the best modification at this time.

Can confirm the following variables work:

TMUX_VER=2.9a
LIBEVENT_VER=2.1.11-stable

Under the latest OSX version (as of today)

❯ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.14.6
BuildVersion:	18G95

@dxps
Copy link

dxps commented Nov 12, 2019

@jnovack,

Sure. Based on the previously listed script, updated the two vars, ran it again and everything went fine.
Maybe just the symlink creation should include the force flag: sudo ln -sf ${COMMON_INSTALL_PREFIX}/bin/tmux ${SYMLINK}

Result:

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.14.6
BuildVersion:	18G103
$
$ tmux -V
tmux 2.9a
$

@mkatychev
Copy link

mkatychev commented Dec 16, 2019

@DEVisions

you should make your own gist, this is the far superior script.

@dxps
Copy link

dxps commented Dec 24, 2019

@mkatychev
Sure, thanks, here it is.

@shrayasr
Copy link
Author

Cheers @DEVisions, I will update the gist to point to yours :)

@dxps
Copy link

dxps commented Feb 8, 2020

@shrayasr Sure! Glad to help. :)

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