Skip to content

Instantly share code, notes, and snippets.

@hoho4190
Last active April 9, 2024 12:09
Show Gist options
  • Save hoho4190/df2bc2a44c78a191bb15b823ef6f1704 to your computer and use it in GitHub Desktop.
Save hoho4190/df2bc2a44c78a191bb15b823ef6f1704 to your computer and use it in GitHub Desktop.
tmux-install-update

Debian GNU/Linux 12 (bookworm) aarch64

https://github.com/tmux/tmux/wiki/Installing#from-source-tarball

pre-install

tmux requires two libraries to be available.

sudo apt update && sudo apt upgrade 
sudo apt install libevent-dev ncurses-dev build-essential bison pkg-config

tmux-install-update.sh

#!/bin/bash

DOWNLOAD_DIR=~/downloads
LATEST_TAG=$(curl -s "https://api.github.com/repos/tmux/tmux/releases/latest" | jq -r '.tag_name')

# version check
if version_info=$(tmux -V); then
        cur_version=$(echo "$version_info" | grep -oP '\K[0-9]+(\.[0-9]+){1,2}[a-z]?')
        if ! dpkg --compare-versions "${LATEST_TAG//v/}" "gt" "$cur_version"; then
                echo "tmux is already the newest version ($cur_version)"
                exit 0
        fi
fi

mkdir -p "$DOWNLOAD_DIR"
cd "$DOWNLOAD_DIR" || exit 1

curl -LO https://github.com/tmux/tmux/releases/download/"$LATEST_TAG"/tmux-"$LATEST_TAG".tar.gz
tar -zxf tmux-*.tar.gz
rm tmux-*.tar.gz && rm -rf ~/tmux
mv tmux-* ~/tmux

cd ~/tmux || exit 1
./configure
make && sudo make install
  • check and set DOWNLOAD_DIR
  • jq required

check

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