A one-shot shell script that fixes the command not found: claude error after installing Claude Code on macOS.
After installing Claude Code, your terminal may not find the claude command because the install directory isn't in your PATH. This happens when your shell config (~/.zshrc or ~/.bashrc) doesn't include the directory where claude was installed.
curl -fsSL https://raw.githubusercontent.com/rsg9999/fix-claude-path/main/fix-claude-path.sh | sh
source ~/.zshrc # or source ~/.bashrc if you use bashOr clone and run locally:
git clone https://github.com/rsg9999/fix-claude-path.git
cd fix-claude-path
sh fix-claude-path.sh
source ~/.zshrc- Searches common install locations (
~/.local/bin,/usr/local/bin,/opt/homebrew/bin) for theclaudebinary - Detects your shell (
zshorbash) - Appends the correct
export PATH=...line to your shell config if it isn't already there - Tells you to
sourceyour config to apply the change immediately
- macOS
- Claude Code already installed (
curl -fsSL https://claude.ai/install.sh | sh) zshorbash
MIT