zmx is a lightweight tool for session persistence of terminal processes. It allows you to run processes in a terminal (shells, editors, builds, etc.), detach from them, and reconnect later without losing input/output or terminal state. Unlike tmux or screen, zmx does not provide windows, tabs, panes, or a window manager — only attach/detach functionality and terminal state restoration.
zmx.sh
What zmx is used for
Main purposes:
- Supporting long-lived terminal sessions that do not disappear when the terminal is closed.
- Detach/attach functionality — detach from a session (Ctrl+\) and return to it later.
- Multiple clients can connect to the same session simultaneously.
- Preserving scrollback and terminal state when reconnecting.
- Supporting workflows such as shells, editors, builds, SSH sessions, and more.
How it differs from tmux:
- zmx does not replace a terminal window manager.
- There is no window/pane management — all logic is focused solely on keeping the session alive.
- Window layout and management are expected to be handled by your shell or window manager.
Installation
Prebuilt binaries
Download the archive for your platform:
- Linux (x86_64 / aarch64)
- macOS (x86_64 / aarch64)
Repository links: https://github.com/neurosnap/zmx
Via Homebrew (macOS / Linux)
brew install zmx
Building from source
Requires Zig (v0.15):
Quick start — command and output
After installation, the following command is available:
Main commands
| Command | Description |
|---|---|
| zmx attach <name> | Creates a new session with the specified name or attaches to an existing one |
| zmx attach <name> <command> | Attaches to a session and runs the specified command inside it |
| zmx detach Ctrl + \ |
Detaches the current terminal from the session without stopping running processes |
| zmx list | Displays a list of all active zmx sessions |
| zmx kill <name> | Forcefully terminates the specified session |
| zmx help | Shows help for available commands |
| zmx version | Displays the installed zmx version |
Shell configuration
To see that you are inside a zmx session, you can add the session name to your prompt:
fish:
function fish_prompt
if set -q ZMX_SESSION
echo -n "[$ZMX_SESSION] "
end
_original_fish_prompt
end
zsh:
PROMPT="${ZMX_SESSION:+[$ZMX_SESSION]} $BASE_PROMPT"
Using zmx with SSH
zmx works well over SSH: you can set a RemoteCommand so that you automatically attach to the appropriate session upon connection. For example:
RemoteCommand zmx attach %k
RequestTTY yes
This is useful if you use many terminals on the same remote machine.
FAQ
- Q1: Why use zmx instead of tmux?
A: zmx is a minimalist tool focused solely on session persistence, without windows or panes, making it simpler and more compatible with modern terminal features.
zmx.sh - Q2: Does it work on Windows?
A: At the moment, zmx officially supports Linux and macOS. Windows is not supported.
zmx.sh - Q3: Can zmx be used with programs like vim, neovim, or build tools?
A: Yes — you can pass any command during attach, and it will be run inside the session.
erock-git-zmx.pgs.sh - Q4: What happens if a session crashes?
A: When reconnecting, zmx will restore the screen state and output as much as possible.
zmx.sh
Conclusion
zmx is a convenient tool for developers who want to preserve terminal sessions between reconnects without introducing the complexity of full-featured terminal multiplexers. It allows you to keep long-running processes alive while continuing to use your terminal emulator and window manager exactly as you prefer, instead of replacing them with an additional layer of window and pane management.
In practice, zmx works especially well for long-running builds, test suites, and data processing tasks, where accidental terminal closure or SSH disconnects would otherwise interrupt work. When used over SSH, it can significantly simplify remote workflows by automatically reattaching to the same session after reconnecting. Running editors such as Vim or Neovim inside a zmx session helps avoid losing context or progress due to network issues, while organizing sessions by project name keeps your workflow predictable and easy to manage.
Overall, zmx is a strong choice for workflows that require reliable session persistence but do not benefit from the overhead of traditional terminal multiplexers, making it ideal for users who value simplicity, stability, and control.