Requirements
- Node.js 18 or higher — Claude Code checks the Node.js version at startup and exits with an error if it is below 18.
- npm — included with Node.js.
Install Claude Code
Install globally with npm:Platform-specific notes
- macOS
- Linux
- Windows (WSL)
npm global installs work out of the box on macOS. If you get a permissions error when running Add the following to your shell profile (Then reload your profile and install:Option B: Use a Node version managerTools like nvm or fnm install Node.js in your home directory, which avoids global permission issues entirely:
npm install -g, you have two options:Option A: Fix npm permissions (recommended)Configure npm to use a directory in your home folder:~/.zshrc or ~/.bash_profile):Updating
Update Claude Code to the latest version with:Uninstalling
Remove Claude Code with:claude binary. Your configuration files in ~/.claude/ are not removed automatically. To delete them:
Troubleshooting
'claude' command not found after installation
'claude' command not found after installation
This usually means the npm global bin directory is not on your The Reload your shell (
PATH.Find where npm installs global binaries:bin subdirectory of that path needs to be on your PATH. For example, if the output is /home/you/.npm-global, add this to your shell profile:source ~/.zshrc or open a new terminal) and try again.Node.js version is below 18
Node.js version is below 18
Claude Code requires Node.js 18 or higher. If you see this error at startup:Upgrade Node.js using your version manager:Or download the latest LTS release from nodejs.org.
Permission denied when running npm install -g
Permission denied when running npm install -g
Do not use Add the
sudo npm install -g — it can leave files owned by root and cause further issues. Instead, fix your npm prefix to point to a user-writable directory:export PATH line to your shell profile so it persists across sessions.Authentication fails on first run
Authentication fails on first run
If the browser-based OAuth flow fails or you cannot use a browser, set your API key directly as an environment variable instead:You can add this to your shell profile to make it permanent. API keys are available in the Anthropic Console.
Running inside Docker or a CI environment
Running inside Docker or a CI environment
In non-interactive environments, authenticate with an API key via the environment variable:Use the If you need Claude Code to operate without permission prompts in a sandboxed container, use the
-p flag to run non-interactively:--dangerously-skip-permissions flag. This flag only works in environments that pass Claude Code’s sandbox safety checks (no internet access and not running as root outside a container).