zmx@sh: ~
zmx

$ zmx attach dev

Session attach/detach for the terminal.

DESCRIPTION

Persist terminal shell sessions while keeping native terminal scrollback and 1:1 terminal emulator features. zmx handles session persistence and defers window management to your OS window manager.

[persistence]

Attach and detach from shell sessions without killing them. Multiple clients can connect to the same session.

[native vt]

Uses libghostty-vt to restore terminal state and scrollback on re-attach.

[ssh workflow]

Combine SSH ControlMaster and autossh with your OS window manager for remote sessions.

[shell integration]

Prompt status, client environment variable tracking, shell completions, and fzf session picker.

[automation]

Send commands without attaching (zmx run), wait on tasks (zmx wait), tail output, or print scrollback history.

[zig package]

Import zmx in Zig projects via src/lib.zig.

Attach and detach

Create or re-attach to a named session:

zmx attach dev

Close your terminal window or run zmx detach (ctrl+\). The session keeps running and restores screen state and scrollback on re-attach.

Run commands without attaching

Send commands to a session and wait for completion:

zmx run build -d zig build
zmx run test -d zig build test
zmx wait build test

Read session output with zmx history or zmx tail.

Remote SSH sessions

Configure SSH ControlMaster in ~/.ssh/config:

Host d.*
    HostName 192.168.1.xxx
    RemoteCommand zmx attach %k
    RequestTTY yes
    ControlPath ~/.ssh/cm-%r@%h:%p
    ControlMaster auto
    ControlPersist 10m

Open a native terminal window per remote session with ssh d.term or autossh. Read the SSH guide.

Install

Available on Linux and macOS:

brew install neurosnap/tap/zmx
# or
mise use zmx
# or
nix run github:NixOS/nixpkgs/nixpkgs-unstable#zmx

See all installation options.

Ready to try zmx?