From 2fd5d06baca8b15e422f3ec71bd2e9eb9ad47400 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Thu, 26 Feb 2026 14:43:03 -0800 Subject: [PATCH] fix(shell): prevent GUI cmux from shadowing CLI on PATH --- .../shell-integration/cmux-bash-integration.bash | 10 ++++++---- Resources/shell-integration/cmux-zsh-integration.zsh | 12 +++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Resources/shell-integration/cmux-bash-integration.bash b/Resources/shell-integration/cmux-bash-integration.bash index bf407773..85027ee4 100644 --- a/Resources/shell-integration/cmux-bash-integration.bash +++ b/Resources/shell-integration/cmux-bash-integration.bash @@ -236,15 +236,17 @@ _cmux_install_prompt_command() { fi } -# Ensure Resources/bin is at the front of PATH. Shell init (.bashrc/.bash_profile) -# may prepend other dirs that push our wrapper behind the system claude binary. +# Ensure Resources/bin is at the front of PATH, and remove the app's +# Contents/MacOS entry so the GUI cmux binary cannot shadow the CLI cmux. +# Shell init (.bashrc/.bash_profile) may prepend other dirs after launch. _cmux_fix_path() { if [[ -n "${GHOSTTY_BIN_DIR:-}" ]]; then - local bin_dir="${GHOSTTY_BIN_DIR%/MacOS}" - bin_dir="${bin_dir}/Resources/bin" + local gui_dir="${GHOSTTY_BIN_DIR%/}" + local bin_dir="${gui_dir%/MacOS}/Resources/bin" if [[ -d "$bin_dir" ]]; then local new_path=":${PATH}:" new_path="${new_path//:${bin_dir}:/:}" + new_path="${new_path//:${gui_dir}:/:}" new_path="${new_path#:}" new_path="${new_path%:}" PATH="${bin_dir}:${new_path}" diff --git a/Resources/shell-integration/cmux-zsh-integration.zsh b/Resources/shell-integration/cmux-zsh-integration.zsh index 29a4be37..a9f1137a 100644 --- a/Resources/shell-integration/cmux-zsh-integration.zsh +++ b/Resources/shell-integration/cmux-zsh-integration.zsh @@ -368,17 +368,19 @@ _cmux_precmd() { fi } -# Ensure Resources/bin is at the front of PATH. Shell init (.zprofile/.zshrc) -# may prepend other dirs that push our wrapper behind the system claude binary. +# Ensure Resources/bin is at the front of PATH, and remove the app's +# Contents/MacOS entry so the GUI cmux binary cannot shadow the CLI cmux. +# Shell init (.zprofile/.zshrc) may prepend other dirs after launch. # We fix this once on first prompt (after all init files have run). _cmux_fix_path() { if [[ -n "${GHOSTTY_BIN_DIR:-}" ]]; then - local bin_dir="${GHOSTTY_BIN_DIR%/MacOS}" - bin_dir="${bin_dir}/Resources/bin" + local gui_dir="${GHOSTTY_BIN_DIR%/}" + local bin_dir="${gui_dir%/MacOS}/Resources/bin" if [[ -d "$bin_dir" ]]; then - # Remove existing entry and re-prepend. + # Remove existing entries and re-prepend the CLI bin dir. local -a parts=("${(@s/:/)PATH}") parts=("${(@)parts:#$bin_dir}") + parts=("${(@)parts:#$gui_dir}") PATH="${bin_dir}:${(j/:/)parts}" fi fi