I know everyone uses Cmder, but it didn’t work for me. It hung a few times, it has way too many options, it has issues sending signal to kill a process. I gave up on using it. I work with carefully configured default Windows console and believe it or not, it serves the purpose. I also know you can use Windows Subsystem For Linux under Windows 10, which is truly amazing, but I am just talking about the cases where you need standard Git for Windows installation.
When I worked with Unix I liked GNU Screen, which is terminal multiplexer. It gives you a bunch of keyboard shortcuts to create separate shell processes under the same terminal window. The problem is, it is not available under GIT Bash. But it turns out, its alternative — Tmux is.
I did a little research and have found that GIT Bash uses MINGW compilation of GNU tools. It uses only selected ones. You can install the whole distribution of the tools from https://www.msys2.org/ and run a command to install Tmux. And then copy some files to installation folder of Git. This is what you do:
- Install before-mentioned msys2 package and run bash shell
- Install tmux using the following command:
pacman -S tmux
- Go to msys2 directory, in my case it is
C:\msys64\usr\bin
- Copy
tmux.exe
andmsys-event-2-1-4.dll
to your Git for Windows directory, mine isC:\Program Files\Git\usr\bin
. Please note, that in future, you can see this file with the version number higher than 2-1-4
And you are ready to go. Please note, that I do this on 64-bit installations of Git and MSYS . Now when you run Git Bash enter tmux
. My most frequently used commands are:
CTRL+B
, (release and then)C
— create new shell within existing terminal windowCTRL+B
,N
— switch between shellsCTRL+B
, a digit — switch to the chosen shell by the corresponding numberCTRL+B
,"
— split current window horizontally into panels (panels are inside windows)CTRL+B
,o
— switch between panels in current windowCTRL+B
,x
— close panel
This is everything you need to know to start using it. Simple. There are many other options which you can explore yourself, for example here http://hyperpolyglot.org/multiplexers.
Update 1: Users in comments are reporting the method not always works. If you have any experiences with this method please feel free to comment, so that we can figure out what are the circumstances under which it works
Update2: I managed to run this on Windows 7, Windows 2012 R2 and Windows 10. My Git installation is set up to use MinTTy console and tmux works only when run from this console, not from default Windows command line console. Still haven’t figured out what are precise requirements for this trick
Thanks for this! However I was unable to get tmux to work by simply copying tmux.exe and msys-event-2-1-4.dll over. Unsure of what else I was missing, I ended up brute force copying my entire mysys64\usr\bin into PortableGit\usr\bin and it worked. It’s not pretty, I’m still wondering which packages I was missing :/
hi @pjsen and @bokwoon, still not working tried both of you methods. I’m not missing something (sad face)
That’s interesting why it doesn’t work. I did some extra tests, I clean-installed newest version of Git for Windows 64-bit under VM and copied those two files. It works. You probably are getting messages about missing files. What are those messages? What is your bitness of MSYS installation and Git installation?
Hi, I’ve meet the same problem.
I’ve installed MSYS2, upgrade packages by ‘pacman -Syu’ and ‘pacman -Su’, then finally get tmux installed.(I can use it in MSYS terminal).
But after I copy those files(tmux.exe and msys-event-2-1-6.dll) into git folder(C:\Program Files\Git\usr\bin), I tried tmux in git bash but nothing happened(no console, only switch to a new line).
Btw, I’m using win10 and Git bash 2.19.0-64-bit.
Thanks for your sharing!
I’ve done my tests under Windows Server 2012 R2 and Windows 7. I’ll do also on Windows 10 and then update the post accordingly. But still, in my opinion, there is no point using this trick under Windows 10, where you can work with native Linux binaries of Git and whatever console multiplexer you want.
This worked for me with no issues, thanks for the post.
Salut,
Suivre 1 et 2 puis
C:\msys64\usr\bin
tmux.exe et msys-event-2-1-6.dll
dans (chez moi)
C:\git-sdk-64\usr\bin
Coller
Dans mon cas ça marche
Do you guys mind providing steps to install tmux on my windows 10 laptop ? I am unable to use linux distro for Win10 on my office laptop for some reasons.
Thank you in advance.
you actually have to put the two files in this folder :
C:\Program Files\Git\mingw64\bin
then it works
(in my case, msys-events is 2.1.6)
Tried C:\Program Files\Git\mingw64\bin as well as C:\Program Files\Git\usr\bin, but no joy :’C – when typing “tmux” nothing happens, no error output either.
Git-Bash for Windows doesn’t pacman. How it suppose to be installed?
I had this problem too as it wasn’t that explicit in the tutorial. You open mysys’s bash, not git bash.
At long last I can enjoy tmux at work, many thanks for putting this up !
In my case this didnt work.
Copying all files that didn’t exist in one usr/bin from another didn’t help either.
Only when copied all files with replacing existing made it work..
Maybe it’s version of ncurses or sth else (probably my git bash installation was much older then freshly installed msys)
This what I’ve done to make it work in my git bash, I copied msys-2-0.dll, msys-event-2-1-7.dll, msys-ncursesw6.dll and tmux.exe from C:\msys64\usr\bin to [your-gitbash-loc]\Git\usr\bin
For anyone having issues copy the files “tmux.exe” and “msys-event-*.dll” to:
“C:\Program Files\Git\usr\bin\”
Hi,I followed the steps and i am seeing
rakshith@1278-laptop MINGW64 ~
$ tmux
open terminal failed: not a terminal
did i miss some step?
Hi, as of the date of this post, I was at first not able to get tmux to run under Git Bash, but it could run under mysys. However, after uninstalling Git Bash and getting the latest version of it, and then following the instructions here, I was able to get tmux to run inside Git Bash, happily.
I found the path on my Windows 10: C:\Program Files\cmder\vendor\git-for-windows.
I failed to enable Tmux in Cmder in the way you introduced in the post.
Can you have a look?
Method described in the article works like a charm for me on Win 10, thanks a lot!
Download Git for Windows SDK, install it and pacman -S tmux
This is 19 July 2020 Covid19 pandemic era :). I just want to thanks a load to you for this article. After searching the entire internet on tmux, this is the best practically oriented article to get hands on tmux via git bash. It resolved my problem!!! You are an angel!!! 🙂
It wasn’t working for me originally, but I saw a recommendation that updating your version of git may be necessary (https://gist.github.com/lhsfcboy/f5802a5985a1fe95fddb43824037fe39). After updating my git version, it worked.
I tried this on Windows 7, git 2.28.0.windows.1, msys-event-2-1-7.dll and tmux launches. It’s great until I want to cutomize .tmux.conf
bind r source-file ~/.tmux.conf \; display “Reloaded!”
set -g status-fg white
set -g status-bg black
When launching tmux I have:
/.tmux.conf:2: bad colour: white
/.tmux.conf:3: bad colour: black
The binding works, it shows “Reloaded!” in the status bar when I do ctrl+b r
But the color customization returns bad colour and don’t change the colour …
Thanks a lot.
Only one addition for May of 2021.
You have to copy the following files to Git’s bin directory:
– tmux.exe
– msys-event-2-1-7.dll
– msys-event_core-2-1-7.dll
Everything worked on my Windows 10 – only difference was that I had to copy msys-even_core-#-#-#.dll to the Git binaries instead of msys-event-#-#-#.dll
Thanks for the walk through!
Does anyone know why simple config
like this:
# ~/.tmux.conf
# unbind default prefix and set it to ctrl-a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
Doesn’t work?
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.)
I couldn’t make tmux open from the gitbash window. But still, when I run directly the tmux.exe from the gitbash window, but pointing out the path to tmux.exe in the msys2 directory – `~/../../Program\ Files/Git/bin/tmux.exe` – then it starts just fine.
So I ended up adding an alias in `~/.bashrc` like so:
`alias tmux=’~/../../Program\ Files/Git/bin/tmux.exe’`
and every time I start git bash – I can directly run `tmux` and tmux will start just fine.
PS: I wanted to use gitbash and not msys2 terminal because for some reason when I start msys2 I don’t have access to some things I’ve installed – for example git and go. But when I start gitbash – then I have access. (Which also includes the scenario I start gitbash, then start tmux in it and from tmux I try to access git or go or whatever.)