openclaw: command not found almost always means your shell cannot see the directory where the openclaw executable was installed. OpenClaw is usually installed, but that directory (normally npm's global bin) is missing from your PATH. Find that directory, add it to your shell's startup file, and open a new terminal. You rarely need to reinstall.

Independent guide. Checked on November 2, 2026 against the official Node.js setup and troubleshooting, install overview, and installer internals pages. General shell behavior (bash login files, fish, sudo) is standard Unix behavior, not OpenClaw-specific documentation.

What the error looks like

The wording depends on your shell, but the cause is the same:

Shell Message
bash (Linux, WSL, older macOS) -bash: openclaw: command not found or bash: openclaw: command not found
zsh (default on macOS) zsh: command not found: openclaw
fish fish: Unknown command: openclaw
PowerShell The term 'openclaw' is not recognized as the name of a cmdlet, function, script file, or operable program.
Command Prompt 'openclaw' is not recognized as an internal or external command, operable program or batch file.

The leading - in -bash: only means bash is running as a login shell (an SSH session, or the macOS Terminal). That matters for which startup file you edit; see bash login shells below.

Quick diagnosis (60 seconds)

Run these in the same terminal where the error appears:

node -v           # Is a supported Node installed and selected?
npm prefix -g     # Where does npm put global packages?
echo "$PATH"      # Is that prefix's bin directory listed?
command -v openclaw || ls "$(npm prefix -g)/bin" | grep openclaw

How to read the result:

  • node is also not found. Node is missing or not initialized in this shell. Fix Node first (see version managers).
  • openclaw exists in $(npm prefix -g)/bin but that directory is not in $PATH. This is the classic case. Go to Fix on macOS and Linux.
  • openclaw is not in npm's global bin at all. The install did not finish, used another method (Git, local prefix, pnpm, bun), or ran under another Node version or user. See other install methods.

The official docs list the same three checks (node -v, npm prefix -g, echo "$PATH") as the first step for this error.

Fix on macOS, Linux and WSL

Add npm's global bin to PATH

The official fix is to put npm's global bin directory on your PATH in your shell startup file.

For zsh (macOS default), add this line to ${ZDOTDIR:-$HOME}/.zshrc. For bash, add it to ~/.bashrc:

export PATH="$(npm prefix -g)/bin:$PATH"

Then open a new terminal, or refresh the current shell's command cache:

hash -r   # bash
rehash    # zsh

Check:

openclaw --version

Bash login shells and the -bash variant

If you see -bash: openclaw: command not found over SSH or in the macOS Terminal, bash is a login shell. Login shells read ~/.bash_profile (or ~/.profile when no ~/.bash_profile exists), not necessarily ~/.bashrc. This is standard bash behavior.

If you edited ~/.bashrc and nothing changed, make sure your login file loads it. Add this to ~/.bash_profile:

[ -f ~/.bashrc ] && . ~/.bashrc

Many Linux distributions already do this in ~/.profile. Check before you add a duplicate.

fish shell

fish does not read .bashrc or .zshrc. Add the directory with fish's own command, which saves it for future sessions:

fish_add_path (npm prefix -g)/bin

The OpenClaw docs do not cover fish. This is standard fish usage, so check fish_add_path --help if your fish version is old.

EACCES permission errors on Linux

If npm install -g failed with EACCES, the global prefix is probably a root-owned directory, so the CLI was never installed. The official docs recommend a user-writable prefix instead of sudo:

mkdir -p "$HOME/.npm-global"
npm config set prefix "$HOME/.npm-global"
export PATH="$HOME/.npm-global/bin:$PATH"

Add the export PATH=... line to ~/.bashrc or ${ZDOTDIR:-$HOME}/.zshrc, then reinstall OpenClaw as your normal user. The official install.sh can also switch the prefix to ~/.npm-global for you and append the PATH export to existing shell rc files.

Avoid recursive chown on system directories just to make one command pass. See installation errors and fixes for the wider permission case.

WSL is a separate environment

A CLI installed inside WSL2 is not on the Windows PowerShell PATH, and the reverse is also true. Run openclaw in the environment where you installed it. If you use WSL for the Gateway, keep the CLI and service commands inside WSL.

nvm, fnm and other version managers

Version managers keep a separate global package set for each Node version. Two common traps:

  1. The manager is not initialized in new shells. The official docs warn that if nvm or fnm is not set up in ~/.zshrc or ~/.bashrc, openclaw may not be found in new terminal sessions because Node's bin directory is not on PATH.
  2. You switched Node versions. If you installed OpenClaw under one Node version and then ran nvm use with another, that version's global bin does not contain openclaw. Switch back, or install OpenClaw again under the version you now use.

Check that the active Node meets OpenClaw's requirement. At this review the docs list Node 24.16.0+ on 24.x or Node 26.1.0+, with Node 26 recommended. Node 22, 23 and 25 are unsupported. See How to Install OpenClaw for the current install path.

Fix on Windows (PowerShell)

The official PowerShell installer (iwr -useb https://openclaw.ai/install.ps1 | iex) adds the needed bin directory to your user PATH when it can. A PATH change only reaches new windows, so close PowerShell and open a new one first.

If it is still not found:

  1. Find npm's global directory:

    npm config get prefix
    
  2. Add that directory to your user PATH (Start menu → search Edit environment variables for your account; the official docs describe it as Settings → System → Environment Variables). The official docs note that on Windows you add the prefix itself, with no \bin suffix.

  3. Open a new PowerShell window and check:

    Get-Command openclaw
    openclaw --version
    

If Node itself was missing, the installer may have placed a portable Node under %LOCALAPPDATA%\OpenClaw\deps\portable-node and added it to your user PATH. That also needs a new window before it works.

If you prefer an app over the CLI, the official docs recommend the native Windows Hub companion app for desktop setup.

Installed with another method

The binary lives in a different place depending on how you installed. Make sure the matching directory is on PATH:

Install method Where openclaw ends up (per official docs) PATH fix
install.sh / install.ps1, npm method (default) npm global bin (npm prefix -g) Sections above
install.sh --install-method git Wrapper at ~/.local/bin/openclaw Add ~/.local/bin to PATH
install.ps1 -InstallMethod git Wrapper at %USERPROFILE%\.local\bin\openclaw.cmd Add that folder to user PATH
install-cli.sh (local prefix, no root) Wrapper at <prefix>/bin/openclaw, default prefix ~/.openclaw Add ~/.openclaw/bin to PATH
pnpm add -g pnpm global bin Run pnpm setup, reopen the shell
bun add -g Bun global bin Add Bun's global bin directory to PATH

If you only want to try OpenClaw without a global install, the official quickstart documents npx openclaw@latest.

sudo openclaw, services and cron

  • sudo: openclaw: command not found. sudo usually replaces your PATH with a fixed safe list, so user-installed tools disappear. Don't run OpenClaw as root. Run it as the ordinary user that owns the installation, as the server deployment guide recommends.
  • Scripts, systemd units or crontab entries. These do not read your interactive shell files. Use the full path from command -v openclaw, or let OpenClaw manage the Gateway service with openclaw gateway install, which records its own runtime.

Verify the fix

openclaw --version
openclaw doctor
openclaw gateway status

If the CLI works but the assistant still does not reply, the problem is elsewhere. Continue with OpenClaw not working? 12 fixes or the CLI guide.

FAQ

Why does openclaw work in one terminal but not in a new one?

The working terminal probably had PATH set temporarily, for example by the installer or a manual export. Put the PATH line in your shell startup file (~/.zshrc, ~/.bashrc, ~/.bash_profile, or fish's fish_add_path) so every new shell gets it.

Do I need to reinstall OpenClaw?

Usually not. If ls "$(npm prefix -g)/bin" shows openclaw, the install is fine and only PATH is wrong. Reinstall only if the binary is missing, and keep a backup of ~/.openclaw first. It holds config, credentials and state.

Should I use sudo npm install -g openclaw?

No. Use a user-writable npm prefix such as ~/.npm-global, or the official installer, which can set this up. Root-owned global installs cause later permission and ownership problems.

I'm on Windows and get "is not recognized as the name of a cmdlet". What now?

Open a new PowerShell window first. If that fails, add the output of npm config get prefix (without \bin) to your user PATH and open another new window. If you installed inside WSL, run openclaw from the WSL terminal instead.

It broke after I switched Node versions with nvm. Why?

Each Node version managed by nvm has its own global packages. Switch back to the version you installed OpenClaw with, or reinstall it under the current, supported version.