How to Install Claude Code
Install Claude Code with npm in one command. Requirements, setup steps, and troubleshooting.
How to Install Claude Code?
Install Claude Code globally via npm with a single command: npm install -g @anthropic-ai/claude-code. You need Node.js 18+ and an Anthropic API key (or a Claude Pro/Max subscription) to get started.
Context
Claude Code is Anthropic's terminal-based agentic coding tool — it runs directly in your shell rather than inside an IDE. Because it's distributed as an npm package, installation follows the same pattern as any global Node.js CLI tool. No desktop app download, no IDE plugin marketplace — just a package manager command.
The tool works on macOS and Linux natively. Windows users need WSL 2 (Windows Subsystem for Linux) since Claude Code requires a Unix-compatible shell environment. This is because it executes shell commands, reads your file system, and interacts with git — all operations that depend on a POSIX-style terminal.
Once installed, Claude Code connects to Anthropic's Claude model via API. You'll authenticate either with an API key or through your Claude subscription, depending on your plan. For a deeper look at what you can do after setup — including skills, hooks, and MCP servers — see our Claude Code extension stack guide.
Practical Steps
- Verify Node.js: Run
node --version— you need v18.0.0 or later. If missing, install from nodejs.org or use a version manager likenvm - Install Claude Code:
npm install -g @anthropic-ai/claude-code - Authenticate: Run
claudein your terminal. On first launch, you'll be prompted to sign in with your Anthropic account or provide an API key - Start using it: Navigate to any project directory and run
claudeto begin an interactive session. Claude Code reads your project structure automatically - Optional — create a CLAUDE.md: Add a
CLAUDE.mdfile to your project root with coding standards and project context. Claude Code reads this on every session start to understand your conventions
Troubleshooting common issues:
- Permission errors on install: Use
sudo npm install -g @anthropic-ai/claude-codeon macOS/Linux, or fix your npm prefix withnpm config set prefix ~/.npm-global - Command not found after install: Ensure your npm global bin directory is in your
PATH - Windows users: Install WSL 2 first (
wsl --install), then install Node.js and Claude Code inside the WSL environment
Related Questions
Want more AI insights? Subscribe to LoreAI for daily briefings.