zsh:1: command not found: claude - Claude Code
Quick fix
升级 cc-switch 至 v3.16.4 或更高版本以修复终端启动时未加载 PATH 的问题,或临时切换至系统默认终端。
Symptom
Section titled “Symptom”zsh:1: command not found: claudecc-switch 作为 GUI 应用,启动时继承了系统精简的 PATH(如 macOS 的 launchd 环境)。在 Linux 中,旧版启动脚本使用了 `--norc --noprofile` 参数跳过了 `.bashrc` 的加载;在 macOS 的 Alacritty 终端中,启动命令遗漏了 `-l` (login) 参数,导致 `~/.zprofile` 未被加载。这些原因均导致用户自定义的 PATH(如 `~/.local/bin`)丢失,从而无法找到 `claude` 命令。
此外,不同终端的启动逻辑存在差异。例如 Ghostty 终端还存在命令参数未正确引用的问题,导致 `--resume` 被当成 shell 的位置参数而非 `claude` 的参数。
将 cc-switch 升级到 v3.16.4 或更新版本。该版本修复了 Linux 下强制使用 `--norc --noprofile` 的问题,改为通过交互式 shell(如 `bash -ic`)执行,并探测默认 shell 以正常加载环境变量。
对于 macOS 上的 Alacritty 或 Ghostty 等第三方终端,若升级后仍存在问题,请在 cc-switch 设置中将首选终端临时切换为 macOS 默认终端 (Terminal.app) 或 Kitty。
Affected Versions
Section titled “Affected Versions”ToolClaude Code
Version<= 3.16.3
PlatformsLinuxmacOS
Source Issues
Section titled “Source Issues”本页汇总自 4 个真实 issue
- #2402Linux 终端启动失败:claude 命令未找到 Linux terminal launch fails: claude command not found (PATH missing ~/.local/bin due to --norc --noprofile)
- #2606Ghostty 终端无法恢复历史会话
- #4473Alacritty session resume closes immediately: launcher uses non-login shell (missing -l)
- #6926macOS Terminal launcher + oh-my-zsh update prompt turns `exec` into `xec`
- 为什么切换到 Mac 默认终端就可以正常恢复会话?
- macOS 默认终端 (Terminal.app) 的启动器在 cc-switch 中正确配置了 login shell 参数,能够正常加载 `~/.zprofile` 等配置文件中的 PATH,而旧版 Alacritty 和 Ghostty 的启动逻辑存在缺陷。
- Alacritty 终端窗口打开后立刻关闭是什么原因?
- 因为 Alacritty 以 `-e` 模式启动,当 `claude` 命令因找不到而返回 127 退出码时,终端会随之立即关闭。添加 `-l` 参数加载 PATH 后即可解决。
No such file or directory (os error 2)将 config.toml 中的 model_catalog_json 绝对路径修改为相对路径 cc-switch-model-catalog.json,或升级 cc-switch。either event handler is re-entrantWindows 上出现该崩溃时,企业安全软件冲突场景可尝试设置 WebView2 参数;原帖未提供通用已验证修复。EGL_BAD_PARAMETER:CC Switch Linux 白屏在受影响的 Linux AppImage 环境中,先预加载宿主机的 libwayland-client;若仍白屏,可改用使用系统组件的 .deb 包。
这是一个非官方社区 wiki,与 cc-switch 作者及项目本身无隶属关系。内容整理自项目公开的 GitHub issues。本站不分发任何软件。