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.
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.
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.
ls ~/.local/bin/claude # native installer location
npm prefix -g # then check $(npm prefix -g)/bin/claudeStep 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.
# 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 ~/.bashrcStep 4: Verify
Open a fresh terminal and run the version check again. It should now print a version number.
Result: claude now resolves in any new shell session, and you understand the PATH mechanism behind the most common install error.
Watch related tutorials
6:41
08:00
12:00
14:00
09:00
10:00