How to Fix "Claude Command Not Found" Error ๐Ÿ”ง

Yoni AokiYoni Aoki
3 min read

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:

  1. Add to PATH: export PATH="$HOME/.local/bin:$PATH"

  2. Reload shell: source ~/.zshrc

  3. 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! ๐Ÿš€

0
Subscribe to my newsletter

Read articles from Yoni Aoki directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Yoni Aoki
Yoni Aoki