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.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/manaflow-ai/cmux/llms.txt
Use this file to discover all available pages before exploring further.
Auto-set variables
These variables are automatically set in all cmux terminal surfaces:CMUX_WORKSPACE_ID
UUID of the current workspace. Example value: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:Commands like
send, read-screen, and close-surface use CMUX_SURFACE_ID as the default --surface value.CMUX_TAB_ID
Optional alias forCMUX_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
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 socketcmuxonly/cmux-only: Only cmux processes (default)automation: Allow external automation clientspassword: Require password authenticationallowall/allow-all/fullopenaccess: Full open access (unsafe)
CMUX_SOCKET_ENABLE
Enable or disable the socket. Values:1,true,yes,on: Enable0,false,no,off: Disable
CMUX_SOCKET_PASSWORD
Socket password for authentication (when password mode is enabled). Precedence:--passwordCLI flag (highest)CMUX_SOCKET_PASSWORDenvironment variable- Password file:
~/Library/Application Support/cmux/socket-control-password
CMUX_ALLOW_SOCKET_OVERRIDE
AllowCMUX_SOCKET_PATH to override the default socket path.
Values:
1,true,yes,on: Allow override
- Debug/staging builds: Always allow override
- Production build: Require explicit
CMUX_ALLOW_SOCKET_OVERRIDE=1
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
CMUX_CLAUDE_HOOK_SENTRY_DISABLED
Disable Claude hook Sentry diagnostics. Values:1: Disable Sentry
CMUX_CLAUDE_HOOK_STATE_PATH
Override Claude hook session state file path. Default:CMUXTERM_CLI_RESPONSE_TIMEOUT_SEC
CLI socket response timeout in seconds. Default: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
Always check for cmux context
Always check for cmux context
Check if
CMUX_WORKSPACE_ID is set before assuming you’re in a cmux terminal:Use --json for machine parsing
Use --json for machine parsing
Always use
--json flag when parsing CLI output in scripts:Handle missing variables gracefully
Handle missing variables gracefully
Provide fallbacks for missing environment variables:
Use explicit IDs for non-local operations
Use explicit IDs for non-local operations
When operating on resources outside the current workspace, always specify explicit IDs: