Skip to content
FossShelf
Home / Categories / For Engineers

Zmx

Terminal session persistence for macOS and Linux without tmux overhead

Replaces —

2.29K starsMITlast commit 15 Nov 2026

Who it's for

Developers running long builds or scripts over SSH

Start a build or test run in a named zmx session before closing the SSH connection. When you reconnect later, attach to the session to see output and status. The session and its running process survive the disconnect, so you do not need to babysit the connection or use a wrapper like nohup.

If your remote server already runs a task scheduler or CI runner, those handle detached execution more reliably than a terminal session.

Terminal users on Ghostty, Kitty, or WezTerm

Modern terminals support native splits, tabs, and GPU rendering. Zmx adds only session persistence to that stack, so you keep all the terminal's native features without introducing tmux's rendering pipeline. This is the use case the project was built around: the topics tag on the GitHub repo lists ghostty explicitly.

If you rely on tmux's copy mode, layout presets, or plugin ecosystem such as tmux-resurrect or Tmuxinator, zmx does not replace those features.

Remote developers connecting from multiple machines

Each zmx session is a named environment on the remote machine. Connecting from a laptop, a desktop, and a phone-tethered hotspot all attach to the same session, which holds the running state. SSH ControlMaster in .ssh/config reduces handshake overhead when opening several windows simultaneously.

If you need a graphical remote desktop rather than a text terminal, zmx is the wrong tool.

Automation scripts that need a persistent shell environment

Zmx run sends commands to a named session's PTY without opening a window. Coding agents, CI scripts, and build tools can use this to drive a background session as a stateful execution context that persists between invocations, preserving environment variables and working directory.

If the script only needs background process execution, a process supervisor like systemd or supervisord is more appropriate than a terminal session.

The problem

When you close a terminal window or lose an SSH connection, every process in that session dies. Scripts stop running, REPLs lose their state, and long-running builds are killed partway through. The common fix is tmux, but tmux adds more than session persistence: it becomes a second window manager inside your terminal, with its own pane layout, copy mode, and keybindings to learn and maintain alongside the OS window manager you already use. The problem deepens on modern terminals. Ghostty, Kitty, and WezTerm support GPU rendering, ligatures, and extended color depths natively, but only when tmux is not in the way. Tmux has its own rendering pipeline, and new terminal features wait until tmux implements compatibility. Developers who want persistent sessions without giving up their terminal's native capabilities have historically had no focused tool for that specific need.

How it works

Session persist and resume

Named sessions run as a background daemon and survive terminal closes or SSH disconnects. Attaching to an existing session restores the previous terminal state and full scrollback output, so you pick up exactly where you left off. The attach command creates the session if it does not already exist, so there is no separate create step.

Multiple simultaneous clients per session

Multiple terminal windows can attach to the same zmx session at once, and all clients see the same output in real time. This fits workflows where you open several SSH connections to the same machine and want them all pointing at the same running shell.

Send commands without attaching

The zmx run and zmx send commands deliver input to a session's PTY without opening a terminal window. Scripts, build tools, or automation pipelines can drive a named session as a background worker. The zmx tail command follows output without taking interactive control.

Native terminal scrollback

Zmx uses the terminal emulator's own scrollback buffer rather than managing an internal one. GPU acceleration, extended color support, and ligature rendering in Ghostty, Kitty, or WezTerm work unchanged inside a zmx session. The zmx history command also prints the scrollback as plain text or HTML for scripting.

SSH workflow with connection multiplexing

Each named SSH session maps to a zmx session via the RemoteCommand directive in .ssh/config. SSH ControlMaster multiplexes multiple terminal windows over one TCP connection, reducing handshake overhead. Pairing with autossh reconnects sessions automatically after a network drop or laptop lid close.

Zig package for programmatic session control

The core library in src/lib.zig is importable as a Zig package. Other Zig projects can call zmx.run, zmx.list, and related functions to manage sessions programmatically without shelling out to the binary. The package is referenced by commit hash in build.zig.zon for reproducible builds.

Features

  • Session persist and resume
  • Multiple simultaneous clients per session
  • Send commands without attaching
  • Native terminal scrollback
  • SSH workflow with connection multiplexing
  • Zig package for programmatic session control

How to install

Install zmx via Homebrew on macOS and Linux.

brew install neurosnap/tap/zmx

Recommended for this setup

Strengths

  • MIT license with no commercial restrictions: Zmx is MIT-licensed, so you can run it on company infrastructure, include it in a commercial product, and modify it without licensing fees or notification requirements. There are no usage tiers, no seat limits, and no enterprise upsell.
  • No duplicate window manager layer: Tmux adds its own pane and window system on top of your OS window manager, creating two layers that both handle tiling and splits. Zmx skips that layer entirely: your terminal handles windows, zmx handles session continuity. This keeps native terminal features like GPU rendering and font ligatures intact without a compatibility layer in between.
  • Broad package availability across Linux distributions: Beyond the official Homebrew tap and mise support, zmx is packaged for Alpine Linux, Arch AUR (two packages: stable and git-tracking), openSUSE Tumbleweed, and Gentoo. NixOS users can run it immediately via nix run without any local installation. Shell completions for bash, zsh, fish, yash, and Nushell are built in.
  • Session environment variable tracking on reconnect: When you re-attach from a new SSH connection, client-specific variables like SSH_AUTH_SOCK and DISPLAY become stale in the running shell. Zmx tracks these from attaching clients and exposes zmx print-env to inspect or eval-update them before each prompt, keeping the shell environment current across reconnects.

Trade-offs

  • No windows, panes, or splits: Zmx is explicitly scoped to session persistence. It does not provide horizontal or vertical splits, tabs within a session, or a layout manager. Workflows that depend on tmux's layout capabilities need a separate OS window manager or terminal with native tab support to replicate them. This is a design decision documented in the project's philosophy, not a missing feature on the roadmap.
  • Nested sessions redirect rather than stack: Running zmx attach inside an existing zmx session redirects the current client to the named session rather than creating a nested layer. Scripts, build tools, or coding agents that inherit the ZMX_SESSION environment variable from a parent shell will trigger this behavior unexpectedly. The fix is to unset ZMX_SESSION before calling attach, or use zmx run for non-interactive work.
  • macOS and Linux only, no Windows support: Zmx provides prebuilt binaries for macOS (aarch64 and x86_64) and Linux (aarch64 and x86_64). There is no Windows binary and no documented WSL path. Windows users need a different tool for terminal session persistence.

Tech stack

Languages
Zig, Shell, Nix, Go Template, Dockerfile, C
Frameworks
—
Databases
—
Tooling
—

FAQ

Is zmx free to use commercially?

Yes. Zmx is MIT-licensed, which places no restrictions on commercial or internal business use. You can run it on a company server, include it in a product you sell, or modify it without notifying the authors. The MIT license is set in the GitHub repository and confirmed in the Sanity metadata.

Does zmx work on Windows?

No. Zmx supports macOS and Linux only. The project provides prebuilt binaries for macOS (ARM and x86) and Linux (ARM and x86). There is no Windows binary and no documented WSL-specific path in the README or on the project website.

How does zmx differ from tmux?

Tmux is a full terminal multiplexer: it manages windows, panes, and splits in addition to keeping sessions alive. Zmx only handles session attach/detach and explicitly does not provide panes or splits. The practical difference is that zmx uses your terminal emulator's own scrollback buffer and rendering pipeline rather than tmux's, which means features like GPU rendering and ligatures work without a compatibility layer. If you need tmux's layout management or plugin ecosystem, zmx is not a replacement.

Can multiple people connect to the same zmx session at once?

Yes. Multiple clients can attach to the same named session simultaneously, and all see the same output in real time. This works over SSH too: open several terminal windows to the same remote machine and attach each to the same session name. All clients see a live view of the running shell.

What happens if ZMX_SESSION is already set when I run zmx attach?

If ZMX_SESSION is set in the current shell (because you are already inside a zmx session), zmx attach redirects the current terminal to the named session rather than creating a new nested layer. Nested sessions are not supported. To attach on your own behalf from inside a session, unset the variable first: env -u ZMX_SESSION zmx attach other. For non-interactive work, zmx run avoids this issue entirely since it never switches the caller.

Similar tools

More in Engineers