codexmux is a local CLI for saving, listing, and switching between multiple OpenAI Codex CLI account profiles.
It keeps the same command model throughout:
.taras the archive format- a TTY-only interactive home on bare
codexmux - interactive account picking for
switchwhen no account name is provided - styled terminal output for TTY users
- plain, script-safe output when redirected or piped
Install from the personal tap:
brew install slatkisasa/tap/codexmuxDownload a macOS archive from GitHub Releases:
codexmux_Darwin_arm64.tar.gzcodexmux_Darwin_x86_64.tar.gzchecksums.txt
git clone https://github.com/slatkisasa/codexmux.git
cd codexmux
go build -o codexmux .go install github.com/slatkisasa/codexmux@latestFrom a local clone, you can still install the current checkout with:
go install .If your Go bin directory is already on PATH, the command will be available as:
codexmuxCore commands:
codexmux list
codexmux current
codexmux save <name>
codexmux add <name>
codexmux switch <name>The CLI also exposes Cobra's generated shell-completion command:
codexmux completionAdditional behavior:
codexmuxwith no subcommand opens an interactive home in a TTYcodexmuxwith no subcommand prints normal help outside a TTYcodexmux switchwith no<name>opens an interactive picker in a TTYcodexmux switchwith no<name>fails with a usage error in non-TTY modecodexmux savewith no<name>prompts in a TTY
The storage layout stays compatible with existing users:
| Path | Purpose |
|---|---|
~/.codex |
Active Codex profile |
~/.codex-switch/state |
Current and previous account state |
~/codex-data/<name>.tar |
Saved account archive |
The state file remains:
CURRENT=...
PREVIOUS=...- Saves and restores use
.tar - The Go CLI ignores legacy
.ziparchives - Restore validation rejects unsafe archive paths before replacing
~/.codex
TTY mode:
codexmuxopens a compact interactive action menu with account summary- compact styled blocks for
current,list, success, warning, error, and progress output - interactive picker for
switchwithout a name
Non-TTY mode:
- plain text only
- no borders, color, or interactive prompts
- output stays easy to parse in scripts
Examples:
codexmux
codexmux list | cat
codexmux current > /tmp/codexmux-state.txt
codexmux switch workcodex login
codexmux save personalcodexmux add work
codex login
codexmux save workcodexmuxChoose Switch Account, then select the target account.
codexmux switchIf stdin/stdout are attached to a TTY, the command opens a keyboard-driven picker.
codexmux switch personal- account names allow only
A-Z,a-z,0-9,.,_, and- - empty names, separators, and traversal-like inputs are rejected
- archives are validated before extraction
- extraction happens in a staging directory first
~/.codexis only replaced after validation and extraction succeed
Run tests:
go test ./...Build:
go build -o codexmux .