cmux/docs-site/content/docs/environment-variables.mdx
Lawrence Chen f36525f5f1 Add documentation site and Homebrew installation
- Add Fumadocs-based docs site (docs-site/)
- Document all features: tabs, notifications, splits, socket API, CLI
- Add Claude Code hooks guide with cmuxterm detection
- Update README with native macOS emphasis and brew install
- Add homebrew-cmuxterm to .gitignore (has its own repo)
2026-01-29 04:41:39 -08:00

179 lines
3.2 KiB
Text

---
title: Environment Variables
description: Environment variables for configuring cmuxterm
---
# Environment Variables
cmuxterm uses environment variables for configuration and integration.
## Socket Control
### CMUX_SOCKET_PATH
Override the default socket path.
```bash
export CMUX_SOCKET_PATH=/custom/path/cmuxterm.sock
```
Default: `/tmp/cmuxterm.sock` (release) or `/tmp/cmuxterm-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
cmuxterm send "hello" # Sends to tab abc123
```
cmuxterm automatically sets this in each terminal session.
### CMUX_PANEL_ID
Default panel ID for CLI commands.
```bash
export CMUX_PANEL_ID=xyz789
cmuxterm send-panel "hello" # Sends to panel xyz789
```
cmuxterm automatically sets this for each split pane.
## Terminal Environment
cmuxterm 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
```
<Callout type="info">
cmuxterm sets this to `ghostty` since it's built on Ghostty. Use the socket check to distinguish from regular Ghostty.
</Callout>
### 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 cmuxterm:
```bash
#!/bin/bash
is_cmuxterm() {
# Check for cmuxterm socket
if [ -S "${CMUX_SOCKET_PATH:-/tmp/cmuxterm.sock}" ]; then
return 0
fi
return 1
}
if is_cmuxterm; then
echo "Running in cmuxterm"
echo "Tab ID: ${CMUX_TAB_ID:-unknown}"
echo "Panel ID: ${CMUX_PANEL_ID:-unknown}"
else
echo "Not in cmuxterm"
fi
```
## Shell Configuration
Add to your `~/.bashrc` or `~/.zshrc`:
```bash
# cmuxterm integration
if [ -S "${CMUX_SOCKET_PATH:-/tmp/cmuxterm.sock}" ]; then
# We're in cmuxterm
# Function to notify on long commands
notify_done() {
"$@"
local exit_code=$?
cmuxterm 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.