Install Tmux on Git for Windows
Tim Jones
Posted on December 7, 2021
Git for Windows is a special version of the MSYS2 with some customizations for better integration with Windows. In particular, in my experience, MSYS2 with Git does not work properly with Visual Studio Code, while Git for Windows works perfectly without any tweaking. However, Git for Windows version of MSYS2 does not include many of the other tools that are available in the standard MSYS2 installation, including Tmux. Nevertheless, we can install Tmux from the MSYS2 repositories with a little bit of effort.
Before making these changes, you should back up the Git for Windows installation directory, typically C:\Program Files\Git
. You can simply copy this directory to another folder so that you have a backup in case something goes wrong in the update process.
Newer packages from the MSYS2 repositories <http://repo.msys2.org/msys/x86_64/> use Facebook's new Zstandard compression. These files have .zst
file extension. To decompress them, you will need to download the zstd for Windows native Windows tool. Place the tool in a directory in your path, such as C:\Windows
, since you will be running this tool from the Windows Command Prompt.
In addition, you will also need a tool capable of extracting tar
archives. Fortunately, the Git for Windows installation includes the tar
utility as one of the standard tools. Or your can use a GUI tool such as 7-Zip, which supports this archive type.
In addition to the Tmux executable itself, a few other files from the standard MSYS2 installation, particularly from the libevent
library, are needed. So we will download several packages from the MSYS2 repositories. Since packages are updated frequently, the version numbers of the packages may change. Accordingly, in the list below, the version numbers are represented by x.y.z-p
. You will need to replace these with the current/latest version number.
libevent-x.y.z-p-x86_64.pkg.tar.xz
tmux-x.y.z-p-x86_64.pkg.tar.zst
To decompress the Zstandard compressed files, run the native Windows zstd
tool (see above) at a Windows Command Prompt with the -d
("decompress") option:
zstd -d tmux-x.y.z-p-x86_64.pkg.tar.zst
This will give you two tar
archives that can then be extracted using the tar
tool at the Git Bash prompt:
tar -xvf tmux-x.y.z-p-x86_64.pkg.tar
tar -Jxvf libevent-x.y.z-p-x86_64.pkg.tar.xz
Since you have updated the files in the running Git Bash session, you will need to close the Git Bash prompt and open a new session. (Note: Tmux only works with the MinTTY version of Git Bash (git-bash.exe
). If you usually use the native bash.exe
or git-cmd.exe
Git prompts, you'll get the error open terminal failed: not a terminal
when trying to run Tmux.)
In the new Git Bash instance, launch a new Tmux session normally by running tmux
. You should see the usual Tmux status bar and you'll be able to use the normal Tmux functions and keyboard shortcuts. Likewise, if you run Git Bash (again, the MinTTY version) in ConEmu, Tmux works just fine in it, as well.
Posted on December 7, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.