Skip to main content
cmux automatically sets environment variables in terminals that identify the workspace, surface, and socket path. This enables CLI commands and scripts to automatically target the correct context.

Auto-set variables

These variables are automatically set in all cmux terminal surfaces:

CMUX_WORKSPACE_ID

UUID of the current workspace. Example value:
Usage:
Most CLI commands use CMUX_WORKSPACE_ID as the default --workspace value when not explicitly provided.

CMUX_SURFACE_ID

UUID of the current terminal surface (also called “panel” or “tab”). Example value:
Usage:
Commands like send, read-screen, and close-surface use CMUX_SURFACE_ID as the default --surface value.

CMUX_TAB_ID

Optional alias for CMUX_SURFACE_ID, used by tab-action and rename-tab as the default --tab value. Usage:

CMUX_SOCKET_PATH

Path to the control socket for the running cmux instance. Default values:
  • Production: /tmp/cmux.sock
  • Debug build: /tmp/cmux-debug.sock
  • Nightly: /tmp/cmux-nightly.sock
  • Staging: /tmp/cmux-staging.sock
Usage:
The --socket CLI flag and custom clients should read CMUX_SOCKET_PATH to connect to the correct instance.

Configuration variables

These variables configure cmux behavior:

CMUX_SOCKET_MODE

Override the socket authentication mode. Values:
  • off: Disable socket
  • cmuxonly / cmux-only: Only cmux processes (default)
  • automation: Allow external automation clients
  • password: Require password authentication
  • allowall / allow-all / fullopenaccess: Full open access (unsafe)
Example:

CMUX_SOCKET_ENABLE

Enable or disable the socket. Values:
  • 1, true, yes, on: Enable
  • 0, false, no, off: Disable
Example:

CMUX_SOCKET_PASSWORD

Socket password for authentication (when password mode is enabled). Precedence:
  1. --password CLI flag (highest)
  2. CMUX_SOCKET_PASSWORD environment variable
  3. Password file: ~/Library/Application Support/cmux/socket-control-password
Example:
Store passwords securely. Avoid hardcoding passwords in scripts. Use the password file for persistent storage.

CMUX_ALLOW_SOCKET_OVERRIDE

Allow CMUX_SOCKET_PATH to override the default socket path. Values:
  • 1, true, yes, on: Allow override
Default behavior:
  • Debug/staging builds: Always allow override
  • Production build: Require explicit CMUX_ALLOW_SOCKET_OVERRIDE=1
Example:

CMUX_TAG

Launch tag for parallel/isolated debug builds. Usage:
Tags are used by the ./scripts/reload.sh --tag <name> script for parallel development.

Debugging variables

CMUX_CLI_SENTRY_DISABLED

Disable CLI Sentry diagnostics. Values:
  • 1: Disable Sentry
Example:

CMUX_CLAUDE_HOOK_SENTRY_DISABLED

Disable Claude hook Sentry diagnostics. Values:
  • 1: Disable Sentry
Example:

CMUX_CLAUDE_HOOK_STATE_PATH

Override Claude hook session state file path. Default:
Example:

CMUXTERM_CLI_RESPONSE_TIMEOUT_SEC

CLI socket response timeout in seconds. Default:
Example:

Shell integration

Add these to your shell profile for enhanced automation:

Bash/Zsh

~/.bashrc or ~/.zshrc

Fish

~/.config/fish/config.fish

Script examples

Multi-workspace build script

Monitor and notify

Context-aware automation

Best practices

Check if CMUX_WORKSPACE_ID is set before assuming you’re in a cmux terminal:
Always use --json flag when parsing CLI output in scripts:
Provide fallbacks for missing environment variables:
When operating on resources outside the current workspace, always specify explicit IDs: