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 ~/.zshrc
Reinstall:
curl -fsSL
https://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,claude
wasn'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! ๐
Subscribe to my newsletter
Read articles from Yoni Aoki directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
