claude: command not found after install? The fix
On this page
  1. Why it happens
  2. Check that this is your problem
  3. The fix
  4. Why "source" sometimes doesn't help
  5. "It works in one window but not another"
  6. An older claude runs instead
  7. Checklist
  8. After it works
  9. Frequently asked questions
  10. Where does Claude Code install?
  11. Why does it say "command not found: claude" after I installed it?
  12. Do I need to restart my computer?
  13. How do I know which shell I use?
  14. Try it with your team

Blog / claude code

claude: command not found after install? The fix

Claude Code installed, but the terminal can't find it. Why ~/.local/bin isn't on your PATH, the one line that fixes it for zsh and bash, and how to check.

You ran the Claude Code installer, it said "successfully installed", you typed claude, and the terminal answered:

zsh: command not found: claude

Nothing is broken. Claude Code is on your computer; your terminal just doesn't know where to look for it yet. This post shows why, the one line that fixes it, and how to check it worked. We ran every command here on fresh Debian machines with both zsh and bash, using Claude Code 2.1.312.

Why it happens#

The installer puts the claude program in a folder called ~/.local/bin (the ~ means your home folder). When you type a command, your terminal only searches the folders listed in a setting called PATH. If ~/.local/bin isn't on that list, the terminal can't find claude, even though it's right there.

On a fresh machine, that folder usually isn't on the list. The installer tells you so, but the note is easy to miss among the other output:

⚠ Setup notes:
  ● Native installation exists but ~/.local/bin is not in your PATH. Run:

    echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc

✔ Claude Code successfully installed!

Check that this is your problem#

Run:

bash
ls ~/.local/bin/claude

If it prints /Users/you/.local/bin/claude (or /home/you/... on Linux), Claude Code is installed and only the PATH is missing. If it says "No such file or directory", the install didn't finish: run the installer again and read the last lines it prints.

The fix#

Which line you need depends on your shell. On a Mac, it is zsh unless you changed it. Not sure? Run echo $SHELL: it ends in zsh or bash.

zsh (most Macs):

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

bash (most Linux machines):

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

Then close the terminal window and start a new one, and type:

bash
claude --version

On our test machines it printed 2.1.312 (Claude Code) straight away.

The line adds ~/.local/bin to the list of folders your terminal searches, and puts it in a file your shell reads every time a new window opens. Copy it exactly, single quotes included. The >> adds the line to the end of the file; a single > would replace the whole file.

Why "source" sometimes doesn't help#

The installer suggests ending with && source ~/.bashrc, which reloads the settings in the window you're already in. In a normal terminal window that works. But on Debian and Ubuntu, ~/.bashrc begins with a check that stops it early when the shell isn't interactive, so in a script, or a command run over SSH without a terminal, the new line at the end never runs. We saw exactly that in our tests: after source, claude was still not found in the scripted shell, while a new interactive terminal found it at once.

So the reliable step is the simplest one: close the window and open a new one.

"It works in one window but not another"#

Each terminal window reads your settings when it opens. Windows that were already open before you added the line keep the old list. Open a new window, or run source ~/.zshrc (or source ~/.bashrc) in each old one.

On Debian and Ubuntu there is a twist: the login settings add ~/.local/bin to PATH automatically, but only if the folder already existed when you logged in. Right after the first install it didn't, so a fresh login (or a restart) can make claude appear without any change, while terminals you opened earlier still can't find it. Adding the line above makes it work everywhere, every time.

An older claude runs instead#

If claude --version prints an old version, or something that isn't Claude Code at all, a different claude is earlier on your PATH. A common cause is an older install through npm. List every claude your shell can see, in the order it searches them:

bash
type -a claude

In our test, with an old copy left in /usr/local/bin, it printed:

claude is /home/b/.local/bin/claude
claude is /usr/local/bin/claude

The first line is the one that runs. Because the fix line puts $HOME/.local/bin before the rest of PATH, the new install wins. If you added the folder at the end instead (PATH="$PATH:$HOME/.local/bin"), the old copy would still run. Change the order, or remove the old copy with the tool that installed it.

If the terminal still tries a path that no longer exists (No such file or directory for a file you deleted), it remembered the old location. Run hash -r and try again.

Checklist#

  1. ls ~/.local/bin/claude: is it installed?
  2. echo $SHELL: zsh or bash?
  3. Add the export PATH=… line to ~/.zshrc or ~/.bashrc.
  4. Close the window; start a new one.
  5. claude --version. Wrong version? type -a claude.

After it works#

Once claude runs, start it in your project folder with cd your-project and then claude. If you work with teammates who each have their own agent, Joxo connects them to one project: your agent and theirs pass work to each other, and you approve from your phone. Get the desktop app, or start your agent through Joxo with joxo claude.

Frequently asked questions#

Where does Claude Code install?#

The native installer puts the claude program in ~/.local/bin, which points to the current version kept under ~/.local/share/claude.

Why does it say "command not found: claude" after I installed it?#

Your terminal's PATH doesn't include ~/.local/bin, so it can't find the program. Add export PATH="$HOME/.local/bin:$PATH" to ~/.zshrc (zsh) or ~/.bashrc (bash), then start a new terminal window.

Do I need to restart my computer?#

No. Opening a new terminal window is enough.

How do I know which shell I use?#

Run echo $SHELL. If it ends in zsh, edit ~/.zshrc; if it ends in bash, edit ~/.bashrc.