--- title: Environment Variables description: Environment variables for configuring cmux --- # Environment Variables cmux uses environment variables for configuration and integration. ## Socket Control ### CMUX_SOCKET_PATH Override the default socket path. ```bash export CMUX_SOCKET_PATH=/custom/path/cmux.sock ``` Default: `/tmp/cmux.sock` (release) or `/tmp/cmux-debug.sock` (debug) ### CMUX_SOCKET_ENABLE Enable or disable the control socket. ```bash export CMUX_SOCKET_ENABLE=1 # Enable export CMUX_SOCKET_ENABLE=0 # Disable ``` Values: `1`, `0`, `true`, `false`, `yes`, `no` ### CMUX_SOCKET_MODE Override the socket access mode. ```bash export CMUX_SOCKET_MODE=notifications # Notifications only export CMUX_SOCKET_MODE=full # Full control export CMUX_SOCKET_MODE=off # Disabled ``` ## CLI Context ### CMUX_TAB_ID Default tab ID for CLI commands. ```bash export CMUX_TAB_ID=abc123 cmux send "hello" # Sends to tab abc123 ``` cmux automatically sets this in each terminal session. ### CMUX_PANEL_ID Default panel ID for CLI commands. ```bash export CMUX_PANEL_ID=xyz789 cmux send-panel "hello" # Sends to panel xyz789 ``` cmux automatically sets this for each split pane. ## Terminal Environment cmux sets these variables in terminal sessions: ### TERM Terminal type for compatibility. ```bash TERM=xterm-ghostty ``` ### TERM_PROGRAM Identifies the terminal application. ```bash TERM_PROGRAM=ghostty ``` cmux sets this to `ghostty` since it's built on Ghostty. Use the socket check to distinguish from regular Ghostty. ### GHOSTTY_RESOURCES_DIR Path to Ghostty resources. ```bash GHOSTTY_RESOURCES_DIR=/path/to/resources ``` ## Testing & Debug ### CMUX_UI_TEST_SHOW_SETTINGS Show the settings window on app launch (for UI testing). ```bash export CMUX_UI_TEST_SHOW_SETTINGS=1 ``` ### CMUX_UI_TEST_TRIGGER_UPDATE_CHECK Trigger an update check on app launch (for testing). ```bash export CMUX_UI_TEST_TRIGGER_UPDATE_CHECK=1 ``` ### CMUX_COMMIT Override the commit hash displayed in the About window. ```bash export CMUX_COMMIT=abc1234 ``` ## Detection Script Check if running inside cmux: ```bash #!/bin/bash is_cmux() { # Check for cmux socket if [ -S "${CMUX_SOCKET_PATH:-/tmp/cmux.sock}" ]; then return 0 fi return 1 } if is_cmux; then echo "Running in cmux" echo "Tab ID: ${CMUX_TAB_ID:-unknown}" echo "Panel ID: ${CMUX_PANEL_ID:-unknown}" else echo "Not in cmux" fi ``` ## Shell Configuration Add to your `~/.bashrc` or `~/.zshrc`: ```bash # cmux integration if [ -S "${CMUX_SOCKET_PATH:-/tmp/cmux.sock}" ]; then # We're in cmux # Function to notify on long commands notify_done() { "$@" local exit_code=$? cmux notify --title "Command Complete" --body "$1" return $exit_code } # Alias for builds alias build='notify_done npm run build' fi ``` ## Precedence Environment variables override app settings: 1. Environment variable (if set) 2. App settings (Settings window) 3. Default value For example, if `CMUX_SOCKET_MODE=full` is set, it overrides the app's Automation Mode setting.