# 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:**

1. Add to PATH: `export PATH="$HOME/.local/bin:$PATH"`
    
2. Reload shell: `source ~/.zshrc`
    
3. Reinstall: `curl -fsSL` [`https://claude.ai/install.sh`](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:

```typescript
zsh: command not found: claude
```

Wait... what? 🤔

## Debugging 🕵️

### Following the Error Messages

I saw this auto-update error message in Cursor:

```typescript
 ✗ 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.
    
    ```typescript
    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](https://zenn.dev/shusaku009/articles/claude-code-update), 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](https://docs.anthropic.com/en/docs/claude-code/troubleshooting)

I tried their [recommended solution](https://docs.anthropic.com/en/docs/claude-code/troubleshooting#recommended-solution%3A-native-claude-code-installation).

```bash
# Install latest version
curl -fsSL https://claude.ai/install.sh | bash -s latest
```

result is...

```typescript
⚠ 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.

```bash
# Verify the installation
which claude
```

result is...

```bash
claude not found
```

I kind of knew it 🫠 But this time I got helpful *setup notes*, which was a plus!

### Update PATH

```typescript
⚠ Setup notes:
  • ~/.local/bin is not in your PATH
  • Add it by running: export PATH="~/.local/bin:$PATH"
```

So I added it.

```bash
# 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.

```typescript
curl -fsSL https://claude.ai/install.sh | bash -s latest
```

This time there is no setup notes. 🥳

```typescript
✔  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! 🚀
