Claude CodeBeginner

How to Fix command not found After Installing Claude Code

Diagnose and repair a PATH problem so the claude command runs from any terminal after install.

6 minBeginner

A common first hiccup: you install Claude Code, type claude, and get command not found. Almost always the binary is installed fine but its folder is not on your shell's PATH. This guide finds the binary and adds it to PATH for good.

What you need

  • A terminal where claude fails to run
  • Knowledge of your shell (zsh or bash)
  • About 5 minutes

Step 1: Confirm the symptom

Reproduce the error so you know you are fixing the right thing.

zsh - error
$claude --version
zsh: command not found: claude
$

Step 2: Find where it installed

The native installer puts the binary in ~/.local/bin. An npm global install puts it under the npm prefix. Check both.

terminal
ls ~/.local/bin/claude        # native installer location
npm prefix -g                 # then check $(npm prefix -g)/bin/claude
Terminal - locate binary
$ ls ~/.local/bin/claude
/Users/you/.local/bin/claude
$ echo $PATH
/usr/bin:/bin:/usr/local/bin
(note: ~/.local/bin is missing from PATH)
The binary exists; it just is not on PATH.

Step 3: Add the folder to PATH

Append the install directory to your shell profile so it loads in every new terminal. Use the line that matches your shell.

terminal
# zsh (default on modern macOS)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

# bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

Step 4: Verify

Open a fresh terminal and run the version check again. It should now print a version number.

zsh - fixed
$claude --version
2.1.0 (Claude Code)
$
Still stuck? Run the doctor
If it works in one terminal but not another, you edited the wrong profile file. Run claude doctor (using the full path ~/.local/bin/claude doctor) to see exactly what it checks and where it expects to be.

Result: claude now resolves in any new shell session, and you understand the PATH mechanism behind the most common install error.

Watch related tutorials

Tags
#troubleshooting#path#install#shell#fix