How to Fix "Claude Command Not Found" Error π§
TL;DR
After updating Cursor editor, Claude Code CLI stopped working with a command not found error. The solution is to reinstall Claude Code and fix PATH configuration.
Quick fix:
Add to PATH:
export PATH="$HOME/.local/bin:$PATH"Reload shell:
source ~/.zshrcReinstall:
curl -fsSLhttps://claude.ai/install.sh| bash -s latest
The Problem π¨
I use Claude Code CLI for my work projects through my company account. Yesterday everything was working fine. Today I updated Cursor editor, and suddenly:
zsh: command not found: claude
Wait... what? π€
Debugging π΅οΈ
Following the Error Messages
I saw this auto-update error message in Cursor:
β Auto-update failed Β· Try claude doctor or npm i -g @anthropic-ai/claude-code
Naturally, I tried both suggestions:
claude doctorβ Of course,claudewasn't working, this also not working.npm i -g @anthropic-ai/claude-codeβ Got a directory conflict error.ENOTEMPTY: directory not empty, rename '/Users/xyz/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/claude-code' -> '/Users/xyz/.nvm/versions/node/v22.14.0/lib/node_modules/@anthropic-ai/.claude-code-MgzGe2Q4'
More digging
I started searching this error. I found a Japanese tech blog Zenn, which I tried but it didn't fix the problem. But I got anthropic url and that helps.
Install latest version
I read official troubleshooting.
https://docs.anthropic.com/en/docs/claude-code/troubleshooting
I tried their recommended solution.
# Install latest version
curl -fsSL https://claude.ai/install.sh | bash -s latest
result is...
β Setup notes:
β’ ~/.local/bin is not in your PATH
β’ Add it by running: export PATH="~/.local/bin:$PATH"
β Claude Code successfully installed!
Version: 1.0.72
Location: ~/.local/bin/claude
Next: Run claude --help to get started
β
Installation complete!
Looks good! π So I tried to verify the installation.
# Verify the installation
which claude
result is...
claude not found
I kind of knew it π« But this time I got helpful setup notes, which was a plus!
Update PATH
β Setup notes:
β’ ~/.local/bin is not in your PATH
β’ Add it by running: export PATH="~/.local/bin:$PATH"
So I added it.
# Open file in edit mode
nano ~/.zshrc
# Add this line and save it
export PATH="$HOME/.local/bin:$PATH"
#Then apply the change
source ~/.zshrc
#Check if the path is saved
echo $PATH
After I confirmed .local/bin: is added, I run install command again.
curl -fsSL https://claude.ai/install.sh | bash -s latest
This time there is no setup notes. π₯³
β Claude Code successfully installed!
Version: 1.0.72
Location: ~/.local/bin/claude
Next: Run claude --help to get started
β
Installation complete!
And when I run claude, it started without Auto-update failed message.
Conclusion & Lessons Learned π
What happened:
- Updating Cursor editor somehow interfered with my existing Claude Code CLI installation.
What I learned:
Editor updates can sometimes affect CLI tools unexpectedly
Always check official documentation when troubleshooting
PATH configuration is crucial for CLI tools to work properly
Clean reinstallation often works better than trying to fix corrupted installs
Now I'm ready to get back to productive coding! π


