# Cloud CLI Reference

cmux vm and cmux cloud are the same command. The CLI talks to the running cmux app, which holds your sign-in. Add --json to any verb for machine-readable output. Every verb has a --help page.

Exit codes: 0 on success, 1 on error, and 2 for an unknown command. cmux vm run returns the remote exit code.

## Sign in

Sign in, check your account, and choose a team.

```
cmux auth login
cmux auth status --json
cmux auth logout
cmux auth team list
cmux auth team use <team-id>
```

## Machines

Create, inspect, change, and delete machines.

```
cmux vm ls [--json]
cmux vm new [--size 4g|8g|16g|24g|32g|64g] [--name <label>] [--workspace <id>] [--window <id>] [--focus true|false] [--detach]
cmux vm base [open] [--detach]
cmux vm base reset [--reason <text>]
cmux vm status <id>
cmux vm stats <id>
cmux vm resize <id> [--cpu <vCPUs>] [--memory <GiB>] [--disk <GiB>]
cmux vm rename <id> <label> | --clear
cmux vm pause <id>
cmux vm resume <id>
cmux vm wait <id> [--timeout <seconds>] [--wake]
cmux vm tools <id>
cmux vm ports <id>
cmux vm rm <id>
```

## Checkpoints and forks

These verbs work when the machine's provider supports them.

```
cmux vm snapshot <id> [--name <name>]      # alias: checkpoint
cmux vm snapshot ls <id>
cmux vm snapshot rm <id> <snapshot-id>
cmux vm fork <id> [--name <name>] [--detach]
cmux vm restore <snapshot-id> [--detach]
```

## Open

Open a machine, a workspace, a terminal, the desktop, or a port in cmux.

```
cmux vm shell <id>                         # alias: attach
cmux vm tui <id>                           # full cmux TUI client
cmux vm desktop <id>                       # alias: vnc
cmux vm open <machine>[/<workspace>[/<terminal>[/<tab>]]] [--workspace <id>] [--focus true|false]
cmux vm open <machine>:desktop
cmux vm open <machine>:port/<n> [--print]
cmux vm open <machine> <port> [--print]
```

## Run commands and agents

Run commands and agents on a machine from your Mac.

```
cmux vm exec [--timeout <seconds>] <id> -- <command...>
cmux vm run [--sync] [--pull <remote-path>] [--machine <id>] [--new] [--size <size>] [--timeout <seconds>] -- <command...>
cmux vm route [--cwd <dir>] [--new] [--provision] [--size <size>]
cmux vm agent --agent claude|codex|opencode|pi [--machine <id>] [--sync] [--cwd <dir>] [--name <name>] [--no-open] [--wait [--output] [--timeout <seconds>]] [--new] [--size <size>] -- <prompt>
cmux vm dev <machine> [<local-dir>] [--name <workspace>] [--layout <file>] [--command "<cmd>"] [--port <n>] [--remote <path>] [--sync|--no-sync] [--no-open] [--dry-run]
cmux vm prompt [--open claude|codex|opencode|pi]
```

## Workspaces and terminals

Control the workspaces and terminals that live on a machine.

```
cmux vm tree [<machine>] [--refresh]
cmux vm workspace new <machine> [--name <name>] [--reuse] [--no-open]
cmux vm workspace open <machine> <workspace-id>
cmux vm workspace rename <machine> <workspace-id> <name>
cmux vm workspace close <machine> <workspace-id>   # terminals keep running
cmux vm workspace rm <machine> <workspace-id>      # terminals stop
cmux vm terminal send <machine> <terminal-id> [text] [--keys <k1,k2>]
cmux vm terminal read <machine> <terminal-id>
cmux vm terminal wait <machine> <terminal-id> --pattern <regex> [--timeout <seconds>]
cmux vm terminal wait-exit <machine> <terminal-id> [--timeout <seconds>]
cmux vm terminal output <machine> <terminal-id> [--after <offset>] [--max-bytes <n>]
cmux vm terminal rename <machine> <terminal-id> <name>
cmux vm terminal close <machine> <terminal-id>
cmux vm layout export <machine> [<workspace>]
cmux vm layout apply <machine> <file>|- [--name <name>] [--cwd <dir>] [--open]
```

## Files and environment

Move files and secrets and set environment variables.

```
cmux vm push <id> <local-path> [remote-path] [--exclude <pattern>]... [--no-default-excludes] [--watch]
cmux vm push --secret <id> <local-file> [remote-path] [--mode <octal>]
cmux vm pull <id> <remote-path> [local-path]
cmux vm env set <machine> KEY=VALUE... | --from-file <.env> | -
cmux vm env ls <machine> [--show]
cmux vm env rm <machine> KEY...
```

## Public URLs

Publish machine ports and manage custom domains and access.

```
cmux cloud domains [list]
cmux cloud domains zones
cmux cloud domains verify <domain>
cmux cloud domains publish <vm> <port> [--domain <hostname>] [--access personal|team|public] [--team <id>] [--yes]
cmux cloud domains access <hostname> personal|team|public [--yes]
cmux cloud domains grant <hostname> <email> [--expires <ISO-date>]
cmux cloud domains ungrant <hostname> <email>
cmux cloud domains grants <hostname>
cmux cloud domains rm <hostname>
```

## VPN

Optional system route for other apps on your Mac.

```
cmux vpn up
cmux vpn status
cmux vpn down
cmux vpn revoke
```

## AI accounts and model routing

Upload agent accounts for your team and check model routing.

```
cmux ai-accounts list
cmux ai-accounts upload claude|codex|anthropic-key|openai-key [--label <label>] [--team <id>]
cmux coderouter status
cmux coderouter machines
```

[Full CodeRouter command reference](https://cmux.com/docs/coderouter/cli)

## Scripting checklist

Before a script creates or uses machines, run these read-only checks. They confirm that you are signed in, show your machines and plan limits, and show which machine a directory uses.

```
cmux auth status
cmux vm ls --json
cmux vm route --json
```

Canonical: https://cmux.com/docs/cloud/cli

Documentation index: https://cmux.com/llms.txt
