Stu Mason
Stu Mason

Claude Code Won't Run? Check Your PATH

Stu Mason2 min read

Claude Code wouldn't start. Turned out to be a rogue alias in my .zshrc from months ago. Here's how to debug PATH issues.

Claude Code Won't Run? Check Your PATH

Installed Claude Code, ran claude, got slapped with:

zsh: no such file or directory: /Users/stumason/.claude/local/claude

What the fuck?

npm said it installed fine. The package is there. But every time I type claude it's looking for some file that doesn't exist.

The Problem

Turns out, at some point I'd added an alias to my .zshrc that was pointing to an old Claude Code location:

alias claude="/Users/stumason/.claude/local/claude"

No idea when I added this. Probably during some beta testing. But it was hijacking the command and sending it to a path that no longer existed.

How I Found It

The magic command:

type claude

This tells you exactly what your shell thinks claude is. Mine said:

claude is an alias for /Users/stumason/.claude/local/claude

There it is. The alias was overriding the actual npm-installed binary.

The Fix

  1. Open .zshrc:

    nano ~/.zshrc
    
  2. Find the offending line (mine was around line 101):

    alias claude="/Users/stumason/.claude/local/claude"
    
  3. Delete it or comment it out

  4. Reload:

    source ~/.zshrc
    
  5. Try again:

    claude --version
    

Done.

Other Shit That Can Break

While I was debugging this, I found a few other common issues:

npm's global bin not in PATH - If you're using nvm, sometimes the global bin directory doesn't get added properly. Check with npm bin -g and make sure that path is in your $PATH.

nvm lazy loading - I had nvm set to lazy-load, which meant node and npm commands weren't available immediately in new shells. Claude Code needs node to run, so if nvm hasn't loaded yet, Claude Code won't work. Fix by changing your .zshrc to load nvm immediately instead of lazily.

Multiple installations - If you've installed Claude Code multiple ways (npm, direct download, homebrew maybe), they can conflict. Pick one and remove the others.

The Takeaway

When a command doesn't work after installation, always check:

  1. type commandname - what does your shell think this command is?
  2. which commandname - where is the binary actually located?
  3. Your shell config files for rogue aliases or PATH modifications

99% of "installation failed" issues are actually just your shell looking in the wrong place.

Get the Friday email

What I shipped this week, what I learned, one useful thing.

No spam. Unsubscribe anytime. Privacy policy.