Skip to content

feat(macos): add cmux as preferred terminal#1947

Open
TaoXieSZ wants to merge 1 commit intofarion1231:mainfrom
TaoXieSZ:feat/cmux-terminal-support
Open

feat(macos): add cmux as preferred terminal#1947
TaoXieSZ wants to merge 1 commit intofarion1231:mainfrom
TaoXieSZ:feat/cmux-terminal-support

Conversation

@TaoXieSZ
Copy link
Copy Markdown

@TaoXieSZ TaoXieSZ commented Apr 8, 2026

Summary

Adds cmux as a macOS Preferred Terminal option for opening the Claude provider terminal and for session resume.

Closes #1949

Problem

  • GUI apps have a minimal PATH (often missing Homebrew), so cmux CLI was not found.
  • cmux's socket defaults to rejecting processes not spawned inside cmux → Failed to write to socket when CC Switch runs cmux new-workspace / send.

Solution

  • New cmux_macos module: resolve CLI (CMUX_CLI, bundle paths, Homebrew, login-shell command -v), run new-workspace + send, and start the app bundle main binary with CMUX_SOCKET_MODE=allowAll where possible.
  • No silent fallback to Terminal.app when cmux is selected (errors stay visible).
  • restart_cmux_for_external_access command + settings UI (when cmux is selected) to quit and relaunch cmux with external socket access.

i18n

en / zh / ja strings for the cmux hint and restart button.

Test plan

  • pnpm typecheck passes
  • cargo check passes
  • Settings → Preferred Terminal → cmux → use Restart cmux for external control once if needed.
  • Claude → Open terminal opens a new cmux workspace and runs the launcher.
  • Session resume in terminal works with cmux selected.

- Add cmux_macos helper: resolve CLI (PATH/Homebrew/login shell/bundle), run
  new-workspace + send, launch bundle main with CMUX_SOCKET_MODE=allowAll
- Provider terminal (misc) and session resume use shared run_in_cmux; skip
  Terminal.app fallback when cmux fails so errors are visible
- Tauri command restart_cmux_for_external_access + settings UI and i18n for
  one-click quit/relaunch when socket rejects external control

Made-with: Cursor
@farion1231
Copy link
Copy Markdown
Owner

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 659088fd10

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if result.is_err() && terminal != "terminal" {
// If preferred terminal fails and it's not the default, try Terminal.app as fallback.
// cmux: do not fall back — failures are usually PATH or cmux socket policy; user should see the error.
if result.is_err() && terminal != "terminal" && terminal != "cmux" {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Clean up temp credential files on cmux launch errors

The new terminal != "cmux" guard means cmux launch failures now return immediately without any cleanup path, even though launch_terminal_with_env has already written claude_<provider>_<pid>.json (with provider env/API keys) and cc_switch_launcher_<pid>.sh to temp storage. Those files are only removed by the shell trap inside the launcher script, which never executes when launch_macos_cmux fails (for example during the documented socket-permission failure path), so repeated failures can leave sensitive credentials on disk.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(macos): add cmux as preferred terminal option

2 participants