Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
You installed Claude. You opened your terminal. And then this happened:
C:\Users\YourName>
claude
‘claude’ is not recognized as an internal or external command,
operable program or batch file.
If you just installed Claude Code (Anthropic’s CLI tool) and got hit with this error the moment you typed claude in your terminal — don’t worry. Your installation probably worked fine. This error almost always means one thing: your system doesn’t know where to find the Claude executable.
This guide will explain exactly why it happens and walk you through every fix, step by step, for Windows, Mac, and Linux.
⚠️
Before you start:This error is about your system PATH — not the Claude app itself. You don’t need to reinstall Claude. In most cases, a single PATH fix resolves it permanently.
When you type any command in a terminal — claude, node, npm — your operating system searches through a list of folders called the PATH to find the matching program. If it can’t find it in any of those folders, it throws this error.
This error is not saying Claude is broken or missing. It’s saying your terminal doesn’t know which folder Claude was installed into — so it can’t run it.
Think of it like a library. The book is there. But if the librarian doesn’t have it in the catalogue, they’ll tell you it doesn’t exist — even though it’s sitting on a shelf somewhere.
💡
Most common cause:Claude Code is installed via npm globally, but npm’s global binary folder is not added to your system’s PATH. This is extremely common on fresh Windows setups and on Mac/Linux machines that haven’t configured their shell profile correctly.
Before fixing the PATH, confirm whether Claude is installed at all. Open your terminal and run:
Terminalbash
npm list -g claude
# or check for the package directly
npm list -g @anthropic-ai/claude-code
If you see the package listed, Claude is installed — and this is purely a PATH issue. Move to Step 2. If the output says empty, install Claude first:
Install Claude Codebash
npm install -g @anthropic-ai/claude-code
Once installed, if the error persists, continue below.
Run this command to find exactly where npm puts its global executables:
Terminal — all platformsbash
npm config get prefix
This will return a path like:
Example outputoutput
# Windows
C:\Users\YourName\AppData\Roaming\npm
# Mac / Linux
/usr/local
# binaries are in: /usr/local/bin
Copy this path. You will need it in the next step.
Press Win + S, search for “Environment Variables” and open “Edit the system environment variables.”
Click Environment Variables → under System variables, find Path → click Edit.
Click New and paste the path you got from npm config get prefix. On most Windows machines this is:
Add this to Windows PATHpath
C:\Users\YourName\AppData\Roaming\npm
Click OK on all dialogs. Close and reopen your terminal completely — not just a new tab. Then test:
Test itcmd
claude –version
# Expected: Claude Code version x.x.x
On Mac and Linux, you need to add the npm binary path to your shell’s profile file. First check which shell you’re using:
Check your shellbash
echo $SHELL
# Returns: /bin/zsh (Mac default) or /bin/bash (Linux default)
Then open the correct profile file and add the PATH export:
For zsh (Mac default — .zshrc)bash
echo ‘export PATH=”$PATH:$(npm config get prefix)/bin”‘ >> ~/.zshrc
source ~/.zshrc
For bash (Linux / older Mac — .bashrc)bash
echo ‘export PATH=”$PATH:$(npm config get prefix)/bin”‘ >> ~/.bashrc
source ~/.bashrc
Then test:
Verifybash
claude –version
# Should return version number — error is gone ✓
If you installed Node.js directly (not via nvm), global npm packages sometimes end up in protected system folders that don’t play nicely with PATH. Installing nvm and switching to an nvm-managed Node version resolves this cleanly.
Install nvm (Mac/Linux)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
nvm install –lts
nvm use –lts
npm install -g @anthropic-ai/claude-code
If you need to use Claude right now while fixing PATH, you can call it using its full path directly:
Windows
%APPDATA%\npm\claude
Mac / Linux
$(npm config get prefix)/bin/claude
If you installed Node.js from an unofficial source or an old version, global packages may not be configured correctly. Download the latest LTS version directly from nodejs.org, reinstall, then reinstall Claude Code via npm. This resets all global binary paths cleanly.
PATH changes don’t apply to already-open terminal sessions. After any fix, always fully close and reopen your terminal. On Windows, sometimes a full system restart is needed for environment variable changes to propagate correctly across all apps.
| Situation | Likely Cause | Best Fix |
|---|---|---|
| Error right after fresh install | npm global bin not in PATH | Step 3 — add PATH for your OS |
| Works in one terminal, not another | Profile file not sourced in that shell | Run source ~/.zshrc or source ~/.bashrc |
| npm itself not found | Node.js not installed or broken | Reinstall Node from nodejs.org |
| Error even after PATH fix | nvm conflict or permissions issue | Fix A — switch to nvm-managed Node |
| Need Claude running right now | PATH not propagated yet | Fix B — run via full executable path |
Fastest fix for most people:Run npm config get prefix, copy the output, add it to your system PATH, close and reopen your terminal. That’s it — Claude will work.
Once fixed, run these three commands to confirm your entire Claude setup is healthy:
Full verification checkbash
# 1. Check Claude is found
which claude # Mac/Linux — should return a path
where claude # Windows — should return a path
# 2. Check version
claude –version
# 3. Start Claude
claude
# Should open the Claude Code interface ✓