A deep dive into cmux
By Flavio
Updated
Tagged: AI
Learn how cmux combines terminals, browsers, notifications, SSH, session restore, and automation into one native workspace for coding agents.
I spend most of my day in terminals, juggling coding agents, dev servers, test suites, deploy scripts, and SSH sessions. A single project easily eats up five or six terminals on its own, and as soon as I open a second project, running commands stops being the hard part. Keeping track of where everything is running and what needs my attention takes over.
cmux is a native macOS terminal built specifically for that problem. It packs a fast terminal, vertical workspaces, split panes, browser tabs, notifications, session restore, SSH, and a CLI that can control the whole app from scripts.
It’s especially useful when you’re running several coding agents at once. One agent can work away in its own workspace while you’re in another, and when it finishes or stops to ask for approval, cmux flags that workspace as unread so you can jump straight there instead of checking every open tab. The built-in browser exposes a full automation interface, too, so an agent can open your local site, inspect the page, click buttons, read console errors, and take a screenshot right next to your terminal.
cmux doesn’t lock you into a special agent runtime either. It runs normal terminal programs: Codex, Claude Code, OpenCode, shell scripts, test runners, whatever you already use. It stays a terminal first instead of turning into an agent orchestrator with a shell bolted onto the side, giving you the workspaces and primitives and letting you decide how to combine them.
In this guide we’ll walk through how cmux is structured, install it, set up a working workspace by hand, automate the built-in browser, connect to remote servers, and look at how it fits across multiple projects.
The problem cmux solves
Running one coding agent is straightforward: open a terminal, move into a repo, start the agent, give it a task. Once you have five of them going at the same time, you end up holding a lot of state in your head:
- which terminal belongs to which repository
- which agent is still working
- which agent needs approval
- where the development server is running
- where you left the test output
- which browser tab belongs to the local app
- which remote terminal is connected to which server
Standard terminal tabs only get you so far before the tab bar turns unreadable. A multiplexer like tmux helps with splits and persistent sessions, especially on remote machines, yet it isn’t a desktop workspace. You don’t get a built-in browser, native macOS notifications, a graphical sidebar, or a DOM automation API out of tmux.
Agent dashboards swing to the other extreme. They understand tasks and agents, so they pull your work into a new interface where you often lose the shell workflow, keyboard shortcuts, and CLI tools you’ve spent years tuning. cmux sits right in the middle:
You keep real terminal processes and all your regular shell tools, plus the layer you need to manage many of them as one system. Here’s how it compares to the other options:
| Capability | Normal terminal | tmux | Agent dashboard | cmux |
|---|---|---|---|---|
| Real terminal programs | Yes | Yes | Depends | Yes |
| Vertical project list | Rare | No | Usually | Yes |
| Split panes | App-dependent | Yes | Usually | Yes |
| Built-in browser | No | No | Sometimes | Yes |
| Native attention indicators | Basic | No | Yes | Yes |
| Scriptable interface | App-dependent | Yes | Product-dependent | CLI and socket API |
| Remote persistence | No | Yes | Product-dependent | Managed SSH and remote tmux |
| Uses my existing agent CLI | Yes | Yes | Not always | Yes |
You won’t reach for cmux for everything. If you just need a single shell, a normal terminal is lighter. A process that has to stay alive for months on a Linux server still belongs in tmux, and a hosted task queue with isolated cloud environments needs more than a local terminal app. cmux is at its best when your Mac is the command center and you want terminals, coding agents, local browsers, and remote hosts inside one scriptable interface.
What cmux is
cmux is a free, open source macOS app, with the source code in the manaflow-ai/cmux repository under the GPL-3.0-or-later license. It’s a native Mac app built on Ghostty’s terminal library, libghostty, so you get a real terminal engine and native macOS controls instead of a web wrapper pretending to be a terminal.
It still feels like a fast terminal, while owning enough of the interface to give you:
- a vertical workspace sidebar
- panes and surface tabs
- an embedded browser
- a notification feed
- file and Markdown viewers
- workspace metadata such as Git branches and listening ports
- custom commands and repeatable layouts
- a CLI and Unix socket API
- managed SSH workspaces
- session restore
cmux treats all of these as primitives rather than forcing a single prescribed workflow. That’s the right call right now, because nobody has settled on one final way to work with coding agents. A flexible terminal handles the workflow you’re using today and won’t get in your way when you change it next month.
Does cmux work on Linux or Windows?
No. cmux is written in Swift and AppKit, so it only runs on macOS 14 or later, on both Apple Silicon and Intel Macs. There’s no Linux or Windows version to install.
You can still use it with Linux servers, though. Running cmux ssh opens a workspace for a remote machine and uploads a small relay program published for x86_64 and ARM64 Linux. The app stays on your Mac while the agents run on the server; I cover that setup in Connect to remote servers.
If your desktop runs Linux, take a look at Herdr, which adds agent status tracking to any terminal, or go with a classic multiplexer like tmux. I compared both of those with Zellij in Herdr vs tmux vs Zellij.
Install cmux
cmux requires macOS 14 or newer on either Apple Silicon or Intel Macs. The easiest way to install it is downloading the DMG from cmux.com, opening it, and dragging cmux into your Applications folder, since that build updates itself automatically with Sparkle.
If you prefer Homebrew, install it from the terminal instead:
brew tap manaflow-ai/cmux
brew install --cask cmux
When a new version comes out, update it with:
brew upgrade --cask cmux
The first launch opens one window with a single workspace and a terminal inside it. Any terminal opened inside cmux already has the cmux command available. If you also want to call it from another terminal app, add the symlink from the installation guide:
sudo ln -sf "/Applications/cmux.app/Contents/Resources/bin/cmux" /usr/local/bin/cmux
Check that the CLI and the running app can talk to each other:
cmux ping
A working connection prints:
pong
Learn the cmux mental model
cmux uses a handful of terms that sound similar at first, so it helps to see how they nest:
A window contains everything
A window is a normal macOS window, with its own sidebar and workspaces. Most of the time one window is plenty, and you can press Command-Shift-N whenever you want a second window for a completely separate visual context.
A workspace is a sidebar entry
A workspace is the main unit you’ll switch between. The UI sometimes calls it a tab because it acts like a vertical tab in the sidebar, while the CLI, socket API, and environment variables all call it a workspace.
The cleanest pattern is one workspace per repository or focused task:
flaviocopes.comaiworkshop.shhostingpicker.devserver operations
Each workspace can hold several split panes. Press Command-N to create a new one, and jump straight to the first nine with Command-1 through Command-9.
A pane is a split region
A pane is one split region inside a workspace. Press Command-D to split right, Command-Shift-D to split down, and Option-Command with an arrow key to move between panes.
For a web project, you might put an agent on the left and the browser on the right. For operational work, you might stack logs on top and an interactive shell below.
A surface is a tab inside a pane
Each pane has its own tab bar, and a surface is one tab in that bar, holding either a terminal or a browser. Press Command-T to open a new surface inside the current pane.
This gives you two levels of organization: workspaces switch the entire project context, while surface tabs switch tools inside a single pane. Your left pane can hold a Codex surface alongside a normal shell surface, while your right pane holds the local site and its Cloudflare dashboard in separate browser surfaces.
A panel is the content
A panel is the terminal or browser content living inside a surface. You won’t think about panels much while using the app directly, because automation usually targets surfaces, though the distinction helps when you’re reading the CLI docs or inspecting JSON output from the API.
Build a useful workspace by hand
Start without any configuration files and put a workspace together manually. Open cmux and move into a project directory:
cd ~/www/flaviocopes.com
Rename the workspace to flaviocopes.com, then start a coding agent in that first terminal:
codex
Split the workspace to the right with Command-D and start the development server in the new pane:
npm run dev
Next, open a browser split with Command-Shift-L and visit your local dev URL:
http://localhost:3000
Now you have all three pieces sitting together in one workspace:
Your agent, server output, and rendered page all travel as one unit. Switch over to hostingpicker.dev and all three tuck away together; switch back and the complete context is still waiting for you.
The sidebar also picks up live project state automatically, showing the working directory, Git branch, and ports opened by processes in the workspace. When several projects grab ports like 3000, 4321, 5173, or 8787, seeing the port right in the sidebar saves you from digging through terminal scrollback to remember which server belongs where.
The shortcuts worth learning first
cmux ships with a long list of shortcuts, so start with the ones you’ll use every day:
| Shortcut | Action |
|---|---|
Command-N | New workspace |
Command-1 to Command-9 | Select a workspace |
Command-T | New surface in the pane |
Command-D | Split right |
Command-Shift-D | Split down |
Option-Command-Arrow | Move between panes |
Command-Shift-L | Open a browser split |
Command-L | Focus the browser address bar |
Command-Shift-P | Open the command palette |
Command-I | Open the notification panel |
Command-Shift-U | Jump to the newest unread item |
Command-Shift-, | Reload configuration |
Every shortcut owned by cmux can be changed in Settings or in cmux.json. It also supports two-step chords, so if your muscle memory comes from tmux, you can wire up a prefix like Control-B:
{
"shortcuts": {
"bindings": {
"newSurface": ["ctrl+b", "c"],
"showNotifications": ["ctrl+b", "i"],
"toggleSidebar": "cmd+b"
}
}
}
You can browse the full set in the keyboard shortcut reference.
Configure the terminal and the application
Configuration splits into two layers: Ghostty handles terminal rendering, and cmux.json handles everything specific to cmux itself.
Ghostty configuration
cmux looks for your Ghostty configuration in these locations:
~/.config/ghostty/config
~/Library/Application Support/com.mitchellh.ghostty/config
If you don’t have the first file yet, you can create it right from the terminal:
mkdir -p ~/.config/ghostty
touch ~/.config/ghostty/config
Here’s a minimal config to get started with font, theme, cursor, and scrollback settings:
font-family = SF Mono
font-size = 14
theme = One Dark
scrollback-limit = 50000000
split-divider-color = #3e4451
cmux configuration
App-level settings live in your home directory here:
~/.config/cmux/cmux.json
On first launch, cmux generates a commented template for you. Even though the file ends in .json, it accepts comments and trailing commas, so you don’t have to fight strict JSON syntax when editing it by hand.
Start with the schema reference so your editor can autocomplete the available keys:
{
"$schema": "https://raw.githubusercontent.com/manaflow-ai/cmux/main/web/data/cmux.schema.json",
"schemaVersion": 1,
"app": {
"appearance": "dark",
"confirmQuit": "always"
},
"terminal": {
"autoResumeAgentSessions": true
},
"browser": {
"openTerminalLinksInCmuxBrowser": true,
"hostsToOpenInEmbeddedBrowser": ["localhost", "*.pages.dev"]
}
}
Whenever you change the file, reload it with this command (or press Command-Shift-,):
cmux reload-config
You can browse every supported key in the configuration reference.
Use project-specific configuration
Global config is the right place for your personal shortcuts and visual preferences. Anything tied to a specific codebase belongs inside the repository instead:
.cmux/cmux.json
In a project config, you can define actions, commands, workspace layouts, and notification hooks without touching your global preferences. Your font choice stays personal, while the command that boots the project travels with the repo.
Because cloning a repository shouldn’t silently authorize arbitrary shell commands on your machine, cmux asks you to trust project commands before running them. Treat .cmux/cmux.json the same way you treat package.json scripts or CI workflows, and read what it runs before approving it.
Save a complete workspace layout
The quickest way to build a layout is to arrange it visually first. Set up your panes and tabs by hand, right-click the plus button, and pick Save Workspace as Layout. cmux writes the splits, working directories, running agents, and browser tabs straight into cmux.json as a reusable action.
If you prefer editing JSON directly, you can write the layout by hand. Here’s a project layout set up for this Astro site:
{
"$schema": "https://raw.githubusercontent.com/manaflow-ai/cmux/main/web/data/cmux.schema.json",
"schemaVersion": 1,
"actions": {
"flaviocopes-site": {
"type": "workspace",
"title": "Open flaviocopes.com",
"restart": "confirm",
"workspace": {
"name": "flaviocopes.com",
"cwd": "~/www/flaviocopes.com",
"layout": {
"direction": "horizontal",
"split": 0.58,
"children": [
{
"pane": {
"surfaces": [
{
"type": "terminal",
"name": "Codex",
"command": "codex",
"focus": true
},
{
"type": "terminal",
"name": "Shell"
}
]
}
},
{
"pane": {
"surfaces": [
{
"type": "terminal",
"name": "Astro",
"command": "npm run dev"
},
{
"type": "browser",
"name": "Local site",
"url": "http://localhost:3000"
}
]
}
}
]
}
}
}
}
}
A layout is a recursive tree where every split has two children, and each child is either another split or a pane holding one or more terminal or browser surfaces. That gives you enough flexibility for anything from a simple side-by-side view to a multi-pane grid.
The restart option decides what happens when a workspace with the same name is already open:
newalways spins up another workspaceignoreswitches focus to the existing onerecreatereplaces the existing workspace without askingconfirmasks before replacing it
When you’re still tweaking a layout, stick with confirm so an accidental click doesn’t wipe out a live session.
Turn repeated shell commands into actions
You don’t need a full workspace layout for every routine task. You can wire everyday shell commands directly into the command palette:
{
"commands": [
{
"name": "Validate blog posts",
"keywords": ["seo", "blog", "check"],
"command": "npm run seo:validate-posts",
"confirm": false
},
{
"name": "Build production site",
"keywords": ["astro", "production"],
"command": "npm run build",
"confirm": true
}
]
}
By default, simple commands run in whichever directory your current terminal happens to be in. That’s handy for quick utilities, though it can bite you if you’re sitting inside a subdirectory when a script expects the repository root. When the directory matters, set it explicitly and add a confirmation prompt for anything that publishes, deploys, migrates data, or mutates external state:
{
"name": "Run project tests",
"command": "cd \"$(git rev-parse --show-toplevel)\" && npm test",
"confirm": true
}
The custom commands guide also covers reusable agent actions, custom keyboard shortcuts, tab-bar buttons, and plus-button menus.
Make agents visible with notifications
The attention system is one of the best parts of cmux when you’re juggling multiple agents. Any terminal can send a notification that lands in the notification panel, marks the workspace unread, and optionally pops up a native macOS alert. You can trigger one from any process running inside cmux:
cmux notify \
--title "Build complete" \
--body "flaviocopes.com built successfully"
If you’re already looking at that workspace, cmux skips the desktop alert so it doesn’t nag you. If you’ve moved on to another task, the workspace gets an unread badge. Press Command-I to open the notification panel, or Command-Shift-U to jump straight to the newest unread workspace.
That changes the day-to-day multi-agent loop:
You don’t always need to call the cmux CLI either. cmux picks up standard OSC 9, OSC 99, and OSC 777 terminal notification sequences, so programs that already emit those work out of the box.
For your own slow commands, a tiny shell helper keeps you from having to type the notification call every time:
notify-after() {
"$@"
local exit_code=$?
if [ $exit_code -eq 0 ]; then
cmux notify --title "Command complete" --body "$1 succeeded"
else
cmux notify --title "Command failed" --body "$1 exited with $exit_code"
fi
return $exit_code
}
Once that’s in your shell config, you can wrap any long-running task like this:
notify-after npm run build
cmux also ships with built-in agent hooks. Run this command to detect supported agent CLIs on your machine and wire up their integrations automatically:
cmux hooks setup
If you only want to set up one specific agent, pass it explicitly:
cmux hooks setup codex
These hooks do more than trigger notifications. For supported agents, they also save the native session identifier so cmux can restore your session later.
Add status, progress, and logs to the sidebar
Notifications tell you when something finished, while sidebar metadata shows what’s happening right now. A script can attach a status pill to its workspace so you can tell its current state at a glance:
cmux set-status build "building" \
--icon hammer \
--color "#ff9500" \
--priority 80
For multi-step tasks, you can update a progress indicator as it goes:
cmux set-progress 0.4 --label "Generating course downloads"
cmux set-progress 0.8 --label "Building the site"
cmux set-progress 1.0 --label "Done"
You can also push short structured log entries to the sidebar:
cmux log --level progress --source build "Astro build started"
cmux log --level success --source build "Production build passed"
Once the job wraps up, clear out the temporary state so stale badges don’t hang around:
cmux clear-status build
cmux clear-progress
Keep sidebar updates high-level. Streaming thousands of build lines into the sidebar just creates noise, since the terminal already holds the full output. Save the sidebar for short status updates so you can scan what each workspace is doing at a glance.
Control cmux from the command line
Everything you can click in the UI is also exposed through the CLI, since both control the same underlying model.
To list your open workspaces, run:
cmux list-workspaces
If a script needs to parse the output, request JSON instead:
cmux list-workspaces --json
You can spin up a new workspace from the terminal:
cmux new-workspace
Or open a split right next to where you’re working:
cmux new-split right
To see which workspace and pane currently have focus, run:
cmux identify --json
You can list all the surfaces inside the current workspace with:
cmux list-panels --json
And you can send input straight to the focused terminal:
cmux send "npm run build"
cmux send-key enter
Better yet, pass a specific surface ID:
cmux send --surface surface:3 "npm run seo:links"
cmux send-key --surface surface:3 enter
Targeting explicitly matters more than it looks. Any script that assumes the right pane is focused will eventually type into the wrong terminal when you click away. Look up the identifier, store it, and pass it on every call.
Inside every cmux terminal, the app automatically exports these environment variables so a running process knows which workspace and surface launched it:
CMUX_WORKSPACE_ID
CMUX_SURFACE_ID
CMUX_SOCKET_PATH
For the full list of commands covering workspaces, panes, surfaces, input, notifications, sidebar state, browsers, and utilities, check the CLI reference.
Understand the Unix socket API
Behind the scenes, the CLI talks to cmux over a Unix socket. By default, the release build listens at this path:
/tmp/cmux.sock
The wire protocol is straightforward: one newline-terminated JSON request per call:
{"id":"workspace-list","method":"workspace.list","params":{}}
The response comes back carrying the same request ID:
{
"id": "workspace-list",
"ok": true,
"result": {
"workspaces": []
}
}
For most scripts, stick with the CLI since it handles argument parsing, formatting, and error reporting for you. Reaching for the socket directly makes sense when you’re building a tighter integration or firing off lots of operations and don’t want the overhead of spawning a new CLI process each time.
Socket access has three modes:
| Mode | Who can connect |
|---|---|
off | Nobody |
cmuxOnly | Processes launched inside cmux terminals |
allowAll | Any local process |
By default, only descendants of cmux terminal processes can connect. That’s a smart boundary to keep in place, since the API can spin up workspaces and type directly into your terminals. If you’re on a shared Mac, leave it set to off or cmuxOnly.
Use the built-in browser manually
Press Command-Shift-L to open a browser split right inside your workspace. Because it runs on WebKit, you get the familiar Safari developer tools: toggle the inspector with Option-Command-I, and open the JavaScript console with Option-Command-C.
For local web development, having the browser attached to the workspace changes how context switching feels. When you jump from flaviocopes.com to hostingpicker.dev, the agent, dev server, logs, and browser all switch together, and each workspace keeps its own cookies and page history.
You can also open links from your terminal straight in the embedded browser, or configure hosts like localhost to stay inside cmux. That gives you a tight development loop:
Automate the browser
You can also script the built-in browser through the same CLI. Start by opening a URL:
cmux browser open http://localhost:3000
Next, find the browser surface identifier so you can target it reliably:
cmux browser identify
That gives you an ID like surface:2. Once you have it, wait for the page to finish loading before reading anything from the DOM:
cmux browser surface:2 wait \
--load-state complete \
--timeout-ms 15000
From there, you can pull out the page title and main heading:
cmux browser surface:2 get title
cmux browser surface:2 get text "h1"
You can also grab a compact snapshot of the interactive elements on the page:
cmux browser surface:2 snapshot --interactive --compact
Or capture a screenshot directly:
cmux browser surface:2 screenshot --out /tmp/homepage.png
Beyond reading pages, the browser CLI handles real interactions like clicking, typing, filling forms, selecting options, scrolling, and waiting on text or selectors:
cmux browser surface:2 fill "#email" --text "reader@example.com"
cmux browser surface:2 click "button[type='submit']" --snapshot-after
cmux browser surface:2 wait --text "Check your email"
It can also read the browser console and any uncaught page errors:
cmux browser surface:2 console list
cmux browser surface:2 errors list
This lets an agent verify the running app instead of stopping at static source files. Whenever a check fails, have it grab three pieces of evidence right away:
cmux browser surface:2 console list
cmux browser surface:2 errors list
cmux browser surface:2 screenshot --out /tmp/cmux-failure.png
The browser automation reference covers the rest of the surface area too, including cookies, local storage, frames, downloads, dialogs, JavaScript evaluation, and browser-state snapshots.
A practical verification script
Putting those pieces together, here’s a small verification script you can run against the homepage after making a change:
#!/bin/zsh
set -e
browser_surface="$1"
verification_result="failed"
if [ -z "$browser_surface" ]; then
echo "Usage: ./verify-homepage.sh surface:ID"
exit 1
fi
cleanup() {
cmux clear-status verify
if [ "$verification_result" = "failed" ]; then
cmux notify \
--title "Homepage verification failed" \
--body "Check the verification terminal for details"
fi
}
trap cleanup EXIT
cmux set-status verify "checking homepage" --color "#0a84ff"
cmux browser "$browser_surface" navigate \
http://localhost:3000 \
--snapshot-after
cmux browser "$browser_surface" wait \
--selector "main" \
--timeout-ms 10000
cmux browser "$browser_surface" get text "h1"
cmux browser "$browser_surface" errors list
cmux browser "$browser_surface" screenshot \
--out /tmp/flaviocopes-homepage.png
verification_result="passed"
cmux notify \
--title "Homepage verified" \
--body "Saved screenshot to /tmp/flaviocopes-homepage.png"
Tailor the checks to whatever you just touched. For a blog post, verify the article heading and Open Graph tags. For a course signup change, test the form submission, confirmation message, and browser console. For a product page, check the displayed price and purchase link.
That gives you a repeatable verification loop:
- change the code
- run the real application
- inspect the real page
- collect useful evidence
- send a notification when the check finishes
How I would use cmux for my site
My main site is an Astro project with a local dev server, a full production build, content validation scripts, internal-link checks, and Cloudflare deployment.
A clean setup for flaviocopes.com is a single workspace split into three panes: Codex and a regular shell sharing the large left pane as two surfaces, the Astro dev server running in the upper-right pane, and the built-in browser sitting right underneath it:
With that layout in place, working on an article like this one follows a clear sequence:
- write and revise the Markdown in the agent surface
- run post and internal-link validation in the shell surface
- keep Astro running in the server pane
- open the scheduled article in the browser after temporarily making it visible locally
- check the heading, code blocks, Mermaid diagrams, and metadata
- run the full production build before wrapping up
Dropping the validation scripts into the project command palette keeps them one shortcut away:
npm run seo:validate-posts
npm run seo:links
npm run build
Because the site has a big archive of posts, a full build takes a while. Wiring up a completion notification means you can switch to something else and let cmux ping you when it’s done, instead of babysitting the build pane every minute.
How I would use cmux for several products
I maintain several independent projects under ~/www, and the cleanest way to organize them in cmux is one workspace per repository, grouped by purpose:
Content
flaviocopes.com
aiworkshop.sh
Products
hostingpicker.dev
migratingto.dev
Operations
Cloudflare
servers
Since cmux supports collapsible workspace groups, the sidebar can mirror that structure without turning into a giant flat list.
There’s no reason to boot up every project every morning, either. Save layouts for the repos you touch often, then spin them up from the plus-button menu only when you’re actively working on them.
For hostingpicker.dev, a focused layout comes down to four surfaces:
- one agent working on a provider comparison
- one shell running tests
- one browser showing the local product page
- one browser pointed at the deployed preview
For AI Workshop, keeping the implementation workspace separate from the public-site workspace avoids a classic mistake: running the right command in the wrong repository. Only active work stays open in the sidebar, rather than every repo sitting on your disk.
How I would use cmux with multiple coding agents
Start with one agent per workspace. It’s the easiest setup to keep straight in your head, because each agent gets its own project folder, terminal, browser, and notifications without stepping on anything else.
Once a task calls for a second agent, add another surface or a split inside that same workspace. A clear division of roles works best:
- Agent 1 implements a narrow, well-defined change.
- Agent 2 reviews the relevant files and tests.
- You step into the shell surface to resolve any conflict.
cmux also hooks into agent-native team features, so Claude Code teammates and supported oh-my-opencode subagents can open as native cmux splits instead of getting buried inside tmux panes.
Just don’t let two agents edit the same file at once. Having them side by side makes parallel work easy to watch, yet they’ll still overwrite each other’s changes if they touch the same files. Divide the work by independent files, or pair one writing agent with a second read-only reviewer.
If you want to compare approaches, check out my deep dive into Herdr. Herdr comes at this from a different angle, running as a persistent terminal multiplexer that models agent lifecycle state. cmux is the better fit when you want a native Mac workspace with a programmable browser built in.
Connect to remote servers
cmux ships with a managed SSH mode that reads your normal host aliases and settings straight from ~/.ssh/config. Connect to a remote host like this:
cmux ssh user@example.com
You can also give the remote workspace a useful name right away:
cmux ssh user@example.com --name "production server"
Or pass an initial command to run as soon as the connection comes up:
cmux ssh user@example.com --command "cd /var/www/app && git status"
On top of a plain SSH terminal, a managed workspace gives you:
- automatic reconnects with exponential backoff
- remote agent notifications routed straight into your local sidebar
- file and image drag-and-drop through
scp - remote browser routing
- persistent remote sessions
That browser routing saves a lot of friction. If a development server runs on port 3000 of the remote machine, open http://localhost:3000 inside that workspace’s browser and cmux sends the traffic through the remote connection automatically. You don’t have to create an SSH -L port forwarding rule by hand. Each remote workspace also gets an isolated cookie store, so a login on one server won’t leak into the browser context for another.
On the first connection, cmux uploads a versioned remote helper and verifies it against an embedded SHA-256 manifest. The SSH documentation covers the relay daemon and security model in full if you want the low-level details.
Combine cmux with remote tmux
Managed SSH sessions can reconnect on their own, though tmux is still useful whenever the remote machine has to own the running process.
cmux has an opt-in remote tmux feature. Enable it under Settings → Beta Features, then connect with:
cmux ssh-tmux user@example.com
Under the hood, cmux uses tmux control mode to project the remote session into native cmux workspaces, tabs, and panes:
| tmux | cmux |
|---|---|
| session | workspace |
| window | surface tab |
| pane | native split |
The tmux server keeps ownership of the remote processes while cmux acts as your local interface. That pairing works well for a long-running server task like this:
If your Mac disconnects, tmux keeps the work alive on the server, and cmux mirrors the remote state again once it reconnects. Since remote tmux is still marked beta, test it on non-critical work before making it part of an operational routine.
Understand session restore
When you quit cmux, it saves the shape of the app:
- windows
- workspaces
- pane layouts
- working directories
- terminal scrollback (best-effort)
- browser URLs and navigation history
When you relaunch it, cmux rebuilds that state. Keep in mind this isn’t the same as freezing arbitrary Unix processes. A normal shell, development server, Vim session, or unsupported terminal program won’t resume at the exact instruction where it stopped; cmux only reopens the terminal context.
Supported coding agents work differently. Hooks can record their native session identifiers, which lets cmux run the agent’s own resume command after rebuilding your layout. Set up the hooks once the agent CLI is installed:
cmux hooks setup
If you’d rather keep layout restore while disabling automatic agent resume, run:
{
"terminal": {
"autoResumeAgentSessions": false
}
}
To reopen your previous session manually at any time, press Command-Shift-O or run:
cmux restore-session
The session restore guide draws a clear line here: cmux restores app-owned state and supported agent sessions, while arbitrary programs start fresh. For arbitrary remote process persistence, stick with tmux or another service manager.
Diagnose a slow workspace
Running several agents, browsers, and development servers at once uses a lot of memory and CPU. Activity Monitor might only show cmux and helper processes, which doesn’t tell you which project is causing the load.
cmux includes a built-in task manager for this. Launch it from the CLI:
cmux top
You can also open the command palette and choose Task Manager. It breaks down resource usage by window, workspace, pane, surface, agent process, and browser web view, so you can trace a spike straight back to the owning workspace instead of killing the whole app.
Reach for it when:
- your Mac’s fans suddenly spin up
- a browser pane eats up unusual memory
- an agent looks stuck
- an old development server is still running
- too many background agents are active at once
Often the right fix is closing a single browser surface or stopping one test watcher instead of restarting everything.
Security boundaries to understand
Because cmux lets processes control the interface, it’s worth understanding the boundaries before you wire up much automation.
Project configuration can run commands
A repository’s .cmux/cmux.json file can define shell commands and startup layouts. cmux shows a trust prompt before running it, so read the configuration before you approve it and treat it like any executable project file.
The socket can type into terminals
Both the CLI and the socket API can send text and key presses directly to a surface. Leave the access mode on the default cmuxOnly unless external automation truly needs allowAll. On a shared machine, consider turning the socket off altogether.
Browser state can contain secrets
Browser cookies and saved state can hold live authenticated sessions. Never commit files created by cmux browser ... state save. Keep them in a temporary or ignored directory and protect them like credentials. Avoid putting passwords directly in shell history too, and pass sensitive values through a proper secret mechanism instead of writing them into a reusable layout.
Sending terminal input is not the same as running a command safely
Sending keystrokes through the CLI is convenient:
cmux send --surface surface:3 "some command"
cmux send-key --surface surface:3 enter
The catch is that it assumes the target surface is a shell waiting for a command. If that pane happens to be inside Vim, an agent prompt, or a confirmation dialog, the same text can have a completely different meaning. Reliable automation should identify the target surface and check its current state before sending input.
Common problems
cmux is not found outside the app
The CLI is available automatically inside cmux terminals. If you want to use it from other terminal applications, create the symlink shown during installation:
sudo ln -sf "/Applications/cmux.app/Contents/Resources/bin/cmux" /usr/local/bin/cmux
The CLI cannot connect
Start by checking whether cmux is running:
cmux ping
Then check the socket mode in Settings. By default, a process outside cmux’s terminal ancestry can’t control the app. You can inspect the available methods and current access mode with:
cmux capabilities --json
Agent notifications do not appear
Install or refresh the integration after installing the agent CLI:
cmux hooks setup
Next, send a direct test notification:
cmux notify --title "Test" --body "cmux notifications work"
If the direct test works, the notification system is fine and the issue is in the agent hook. Also keep in mind that desktop banners are suppressed when that workspace is already active, so check the notification panel and unread state as well.
The restored terminal did not keep its running process
That’s expected for arbitrary local processes. cmux restores the layout and can resume supported agent conversations, while regular shell programs start fresh. Use tmux, a service manager, or managed remote sessions whenever the process itself has to survive independently.
A project layout does not load
Validate the configuration first:
cmux config doctor
Then reload it:
cmux reload-config
Double-check that the file lives in ~/.config/cmux/cmux.json or the repository’s .cmux/cmux.json, and that schemaVersion is set to 1.
A browser check is flaky
Wait for the condition you care about instead of adding arbitrary sleeps:
cmux browser surface:2 wait --selector "main" --timeout-ms 10000
cmux browser surface:2 wait --text "Saved"
cmux browser surface:2 wait --url-contains "/dashboard"
Condition-based waits finish faster when the page loads quickly and hold up better when it’s slow.
cmux compared to Ghostty
cmux uses Ghostty’s terminal engine and reads your Ghostty configuration, yet the two tools solve different problems. Ghostty is a focused, general terminal emulator. cmux builds a full multitasking workspace on top of that engine, adding the vertical sidebar, workspace hierarchy, notifications, embedded browser, automation, session metadata, and agent integrations.
If you just want a clean terminal emulator, stick with Ghostty. Go with cmux when organizing several projects and agents is the bigger problem.
cmux compared to tmux
tmux runs inside any terminal and works on macOS, Linux, and remote servers. It’s mature, portable, and great at keeping processes alive after disconnects. cmux is a native macOS app with a graphical sidebar, native shortcuts and notifications, a built-in browser, and deep local automation.
You don’t have to treat this as an either-or choice. You can run tmux on a remote server and let cmux present that session through its native interface, or run tmux inside a normal cmux terminal. Let tmux own the session when the remote machine has to keep processes alive, and use cmux when you want your Mac to handle the complete working interface.
cmux compared to Herdr
cmux and Herdr both make several terminal agents manageable and expose programmatic control, though they focus on different strengths. cmux is a native Mac app built around workspaces, managing your attention, browser verification, and desktop integration. Herdr is a terminal multiplexer built around persistent PTYs and semantic agent states like working, blocked, done, and idle, running directly on macOS or Linux and looking the same over SSH.
Pick cmux for a polished local Mac development cockpit with a browser next to your terminals. If terminal-native persistence and remote portability matter more to you than a built-in browser, Herdr is the stronger fit.
You can also run Herdr inside cmux: cmux owns the Mac window and browser, while Herdr owns persistent terminal processes locally or on a remote machine. You can explore other tools in this space in Herdr alternatives.
When cmux is a good fit
cmux makes a lot of sense if you’re on macOS and your day looks something like this:
- you juggle several repositories at once
- you run multiple coding agents and want to know which one needs your attention
- you build web apps and want the browser right beside the terminal, so agents can verify changes on a real page
- you connect to development servers over SSH
- you like putting together your own workflows from small, scriptable tools
You probably don’t need it if:
- your main machine runs Linux or Windows
- a single terminal window already covers your work
- every task runs in a hosted environment
- you need arbitrary local processes to survive an app restart
- you want a complete, opinionated agent platform instead of building blocks
If that last point is what you’re looking for, read A deep dive into T3 Code. It gives you a single UI over Codex, Claude Code, Cursor, Grok, and OpenCode.
The biggest limitation is macOS. cmux can control remote Linux servers over SSH, but the app itself only runs on a Mac.
My recommended way to adopt it
Start by using cmux as a regular terminal. Create one workspace per active project and get used to switching workspaces, surface tabs, and splits. Once that feels natural, add the browser pane so your local app sits right next to the dev server, and lean on the browser console and screenshots when checking changes.
After that, set up the agent hooks:
cmux hooks setup
Let those notifications replace the habit of checking every terminal tab by hand. When you’re ready for a bit of setup, save a layout just for the project you open most often, and don’t try to build a universal config on day one.
From there, add two or three command-palette actions for repetitive, safe operations. Leave automated browser checks and sidebar status for last, and only wire them up where they remove real friction. cmux is already useful before you customize anything, so it’s better to notice which parts of your workflow repeat and script those instead of guessing upfront.
Want me to talk about your product? You can sponsor this site.
Related posts about ai: