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.
Top comments (2)
This does not work for me.
I did everything as specified except I used the packages from repo.msys2.org/msys/i686/ since I only have the i686 versions of Git for Windows installed.
I created and used the below script based on this tutorial:
For some odd reason the
sleep 3
lines are required because the script executes out of order without them. For example the unzip fails becaus ethe file is not there yet. I have no idea why other than I am running htis on my new REALLY fast machine.Running
tmux
results in no output to screen and$?=127
inmintty
Got it to work by modifying my script to allow multi architecture with a default to
x86_64
: