Skip to content

tmux

tmux on Windows: WSL2, Git Bash, and what actually works

There is no native Windows build of tmux. WSL2 is the practical option; Git Bash and Cygwin exist but neither runs tmux well. Here is the real setup.

Nadia Okonkwoupdated Aug 10, 20267 min read

There is no native Win32 build of tmux โ€” it depends on a Unix pty layer Windows doesn't have. The practical option is WSL2, which runs a real Linux kernel and a real tmux. Git Bash/MSYS2 and Cygwin can technically launch a tmux binary, but pty emulation on both is incomplete enough that panes, resizing, and mouse support break in ways that make daily use painful. Use WSL2.

Why tmux doesn't just run on Windows

tmux is built directly on Unix ptys (pseudo-terminals) and Unix process semantics โ€” forking, signal handling, SIGWINCH for resize events. None of that exists natively on Win32. Every "tmux on Windows" option is really a Unix compatibility layer running tmux inside it, with whichever gaps that layer has.

OptionWhat it actually isVerdict
WSL2Real Linux kernel in a lightweight VMUse this
Git Bash / MSYS2MinGW pty emulation over Win32 consoleWorks for basic sessions; panes and resize are flaky
CygwinPOSIX layer translating to Win32 callsMore complete than Git Bash, still not a real pty
Windows Terminal aloneA terminal emulator, not a tmux implementationNeeds WSL2 or another backend underneath

Setting up tmux in WSL2

Install WSL2

From PowerShell (as administrator): wsl --install. This installs WSL2 and a default Ubuntu distribution, as documented in Microsoft's WSL install guide. If you already have WSL1 distros, wsl --set-version <distro> 2 upgrades them.

Install tmux inside the distro

Open the Ubuntu shell from the Start menu and run sudo apt update && sudo apt install tmux. See installing tmux if your distro's version is too old for something you need.

Use Windows Terminal as the front end

Windows Terminal (built into Windows 11, installable on Windows 10) auto-detects WSL distributions and gives you a proper profile with correct fonts and true color. Don't run tmux inside the legacy conhost.exe window โ€” Windows Terminal's rendering is meaningfully better and doesn't clip colors.

Verify truecolor works

Run tmux new, then inside it echo $COLORTERM โ€” it should print truecolor if Windows Terminal and your tmux config are both set up right. If it's empty, add set -sa terminal-overrides ",*:RGB" to ~/.tmux.conf; the tmux FAQ walks through the same 24-bit colour question for every other terminal too. This matters most if you edit inside tmux โ€” tmux and vim has the full terminfo and terminal-features setup.

WSL1 still exists โ€” don't use it for this

wsl --install defaults to WSL2 on any reasonably current Windows install, but if you're on an older machine that ended up with WSL1, tmux runs noticeably worse on it. WSL1 translates Linux syscalls to Windows kernel calls rather than running a real Linux kernel, and tmux's pty and signal handling hit enough of the gaps in that translation layer that resizing and job control are unreliable. wsl --set-version <distro> 2 upgrades an existing distro in place.

Clipboard interop: the actual friction point

Copying from tmux's copy mode doesn't reach the Windows clipboard by default โ€” WSL2's Linux environment and Windows are still two separate clipboards until you wire them together. This is the Windows version of a problem every platform has; tmux on Mac covers the pbcopy side of it. Two tools do it here:

ToolDirectionNotes
clip.exeLinux โ†’ Windows onlyShips with Windows, already on PATH inside WSL
win32yankBoth directionsSeparate binary, needs installing and adding to PATH

clip.exe is the zero-install option if you only need copy-out:

~/.tmux.conf
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "clip.exe"

For paste-in too, install win32yank and bind both directions:

~/.tmux.conf
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "win32yank.exe -i"
bind ] run "win32yank.exe -o | tmux load-buffer - ; tmux paste-buffer"
WSL2 โ€” verifying clip.exe reaches Windows
tmux new -s test
echo "does this reach the Windows clipboard" | clip.exe
# switch to Notepad on the Windows side, Ctrl-V
does this reach the Windows clipboard

The gotcha: sessions dying when the last window closes

This is the one that catches people who set up tmux in WSL2, walk away from a running session, and come back to find it gone. WSL2 runs each distro as a lightweight VM that Windows tears down automatically after a short idle period once every WSL window is closed โ€” by default 60 seconds after the last WSL process disconnects, controlled by vmIdleTimeout in %UserProfile%\.wslconfig. A detached tmux session is still a running process, which normally keeps the VM alive, but if you've also enabled systemd=true in /etc/wsl.conf for real service management, some setups report the VM idling out anyway and taking the tmux server with it.

If your tmux sessions keep vanishing after enabling systemd

Check %UserProfile%\.wslconfig for a [wsl2] section and set vmIdleTimeout=-1 to disable the automatic shutdown entirely, or raise it well past however long you're away from the machine. The setting only takes effect after a full WSL restart (wsl --shutdown from PowerShell, then reopen).

%UserProfile%.wslconfig
[wsl2]
vmIdleTimeout=-1

This is worth knowing before you enable systemd in the first place, not after a session vanishes. Most people turn it on chasing systemctl for a database or Docker daemon they want managed properly โ€” if that's the goal, pair it with vmIdleTimeout=-1 from the start rather than debugging a disappearing tmux session later.

Git Bash and Cygwin, honestly

If WSL2 genuinely isn't an option โ€” a locked-down corporate machine, no admin rights to enable it โ€” Git Bash can run tmux, but expect rough edges: pane splits sometimes misrender on resize, and SIGWINCH handling through MSYS2's pty layer is unreliable enough that a maximized window doesn't always tell tmux its new size. Cygwin's mintty is a better terminal for it than Git Bash's default console and gets you closer to correct behavior, but neither is what you'd choose if WSL2 were available. Treat both as a fallback, not a destination.

Checking a WSL2 session from outside Windows

If you're running long jobs inside a WSL2 tmux session and want to check on them from your phone, the normal answer is SSH into the box and tmux attach โ€” see tmux attach session for the mechanics, and tmux from your phone for what a 40-column SSH client actually does to a pane layout. Once tmux itself is running, the rest of your workflow โ€” tmux commands, windows, panes, copy mode โ€” is identical to any other Linux box; the same applies to tmux over SSH, which behaves no differently because the far end happens to be WSL2. If you'd rather open the session in a browser than arrange port forwarding into WSL2 first, that's what mtmux does โ€” it runs inside WSL2 like anything else and serves the session out to whatever device you're holding (what it does, reference docs).

Worth being clear about what that does and doesn't get you: nothing pages you when a WSL2 build finishes. There is no push, no email, no Windows toast โ€” you open the session and look at it, the same way you would by reattaching over SSH. The only thing that changes is what you need in your hand to do the looking.

Can I install tmux directly on Windows without WSL?

Not a real one. tmux depends on Unix pty and process semantics that Win32 doesn't provide. Git Bash and Cygwin can run a tmux binary through compatibility layers, but panes and resizing are unreliable compared to WSL2.

Does Windows Terminal support tmux?

Windows Terminal is a terminal emulator, not a tmux backend โ€” it renders whatever shell you point it at, including a WSL2 distro running tmux. It has good truecolor and font support, which makes it the recommended front end once tmux itself is running in WSL2.

Why does my tmux session in WSL2 disappear after closing all windows?

WSL2 shuts down its lightweight VM a short time after every window connected to it closes, controlled by vmIdleTimeout in .wslconfig (60 seconds by default). Set vmIdleTimeout=-1 to stop it from happening.

How do I copy from tmux to the Windows clipboard?

Bind your copy-mode-vi copy action to pipe into clip.exe, which ships with Windows and is already on WSL2's PATH. For paste support too, install win32yank and bind both directions.

Put this to work โ€” mtmux attaches to the tmux server you already run.

Related reading

tmux

tmux ssh: fixing broken pipe and dropped sessions

tmux over SSH keeps a job running through a dropped connection. The pattern is ssh host -t 'tmux attach || tmux new', plus keepalives for broken pipe.

Ivo Hart8 min read