News
New LLM models now available in the control panel
DF
December 14 2025
Updated December 14 2025

zmx - saving terminal sessions in Linux and macOS

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:

  1. Linux (x86_64 / aarch64)
  2. macOS (x86_64 / aarch64)

Repository links: https://github.com/neurosnap/zmx

Via Homebrew (macOS / Linux)

brew tap neurosnap/tap
brew install zmx

Building from source

Requires Zig (v0.15):

git clone https://github.com/neurosnap/zmx
cd zmx
zig build -Doptimize=ReleaseSafe --prefix ~/.local # make sure ~/.local/bin is in your PATH

Quick start — command and output

After installation, the following command is available:

zmx <command> [args]

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:

functions -c fish_prompt _original_fish_prompt
function fish_prompt
if set -q ZMX_SESSION
echo -n "[$ZMX_SESSION] "
end
_original_fish_prompt
end

zsh:

BASE_PROMPT=$PS1
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:

Host dev.*
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.

Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.