Skip to main content

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.
Check your current version:

Install Claude Code

Install globally with npm:
After installation, verify it works:

Platform-specific notes

npm global installs work out of the box on macOS. If you get a permissions error when running npm install -g, you have two options:Option A: Fix npm permissions (recommended)Configure npm to use a directory in your home folder:
Add the following to your shell profile (~/.zshrc or ~/.bash_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:

Updating

Update Claude Code to the latest version with:
Or use Claude Code’s built-in update command:
To check what version you’re running:

Uninstalling

Remove Claude Code with:
This removes the claude binary. Your configuration files in ~/.claude/ are not removed automatically. To delete them:

Troubleshooting

This usually means the npm global bin directory is not on your PATH.Find where npm installs global binaries:
The 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:
Reload your shell (source ~/.zshrc or open a new terminal) and try again.
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.
Do not use 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:
Add the export PATH line to your shell profile so it persists across sessions.
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.
In non-interactive environments, authenticate with an API key via the environment variable:
Use the -p flag to run non-interactively:
If you need Claude Code to operate without permission prompts in a sandboxed container, use the --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).