solution install high linux macos

npm install -g fails with EACCES / permission denied

Fix global install permission errors on Linux/macOS by switching npm's global prefix to a user-writable directory (avoid sudo).

By CoClaw Team •

Symptoms

  • npm install -g openclaw@latest fails with EACCES / permission denied.
  • Errors mention mkdir in a root-owned directory (common on Linux).

Cause

Your npm global prefix points to a directory that requires root permissions, so global installs fail unless you use sudo (not recommended).

Fix

Switch npm’s global prefix to a user-writable directory:

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

Persist the export PATH=... line in your shell startup file (zsh: ~/.zshrc, bash: ~/.bashrc), then open a new terminal.

Now retry:

npm install -g openclaw@latest

Verify

command -v openclaw
openclaw --help
  • If you then get openclaw: command not found, your PATH still doesn’t include the global bin dir (see the related install/PATH article).

Verification & references

  • Reviewed by:CoClaw Code Team
  • Last reviewed:March 14, 2026
  • Verified on: Linux · macOS
Want to explore more? Browse all solutions or ask in the Community Forum .
Report a problem

Related Resources

Install: 'inappropriate ioctl for device' when running install.sh
Fix
If `curl ... | sudo bash` prints repeated 'inappropriate ioctl for device' and the OpenClaw installer fails or behaves oddly, rerun the installer with a real TTY (or disable gum), or install via npm directly.
npm global install: OpenClaw breaks after upgrade/downgrade (missing dist chunk)
Fix
Fix OpenClaw global installs that break after a version swap (upgrade/downgrade) with errors like 'Cannot find module ... dist/...chunk...' by doing a clean reinstall and refreshing the gateway service install.
Docker: EACCES permission denied writing ~/.openclaw (openclaw.json.*.tmp)
Fix
Fix Docker permission errors when the gateway container can't write to the bind-mounted ~/.openclaw directory (common when host UID/GID != 1000).
openclaw: command not found
Fix
Fix PATH issues that cause the OpenClaw CLI to be missing after install (wrong shell, npm prefix not on PATH, multiple Node installs).
OpenClaw Installation Troubleshooting: Node/NPM, PATH, Windows (WSL2), and Docker
Guide
A layered checklist for the most common 'can't install' / 'command not found' / 'service won't start' failures. Covers Node version, global install permissions, PATH issues, WSL2 systemd, and Docker setup gotchas.
ClawHub Usage Guide: Discover, Evaluate, Install, Upgrade, and Roll Back Skills Safely
Guide
A practical guide to using ClawHub as a skill discovery and distribution channel: how to evaluate maintainers, install in a low-risk way, upgrade without surprises, and keep a real rollback path when a skill fails or disappears.