Claude Code is Anthropic’s agentic coding tool. It reads your codebase, edits files, runs commands and tests, and works through multi-step programming tasks from your terminal, your IDE, the Claude desktop app or the web. This guide shows exactly how to install Claude Code on macOS, Windows and Linux, sign in, and run your first useful task in under ten minutes.
Before you start: requirements
- An account: a paid Claude plan (Pro, Max, Team or Enterprise) or a Claude Console account with API credits. The free Claude plan does not include Claude Code. Not sure which you have? See Is Claude free?
- Operating system: macOS, a modern Linux distribution (Ubuntu, Debian and similar) or Windows 10/11 (natively or through WSL).
- A terminal and an internet connection.
- Git is strongly recommended so you can review and undo changes. On Windows, Git for Windows is needed for the native install.
Method 1: Native installer (recommended)
Anthropic’s native installer is the simplest option. It does not need Node.js and keeps Claude Code updated automatically.
macOS, Linux and WSL
Open Terminal and run:
curl -fsSL https://claude.ai/install.sh | bash
Windows (PowerShell)
Open PowerShell and run:
irm https://claude.ai/install.ps1 | iex
macOS with Homebrew
If you prefer Homebrew:
brew install --cask claude-code
Homebrew installs do not auto-update, so run brew upgrade claude-code occasionally.
Always copy install commands from Anthropic’s official documentation; they can change, and you should never run installer scripts from unofficial sources.
Method 2: npm (older method)
Claude Code can also be installed globally with npm if you already have Node.js 18 or newer:
npm install -g @anthropic-ai/claude-code
Do not use sudo with this command. If you get permission errors, fix your npm prefix or switch to the native installer instead. Anthropic now recommends the native installer for most people.
Step 2: Verify the installation
claude --version
claude doctor
claude doctor checks your installation type, version and common configuration problems. If the claude command is not found, close and reopen your terminal so your PATH refreshes.
Step 3: Log in
- Move into a project folder:
cd path/to/your/project - Start Claude Code:
claude - Choose how to sign in: your Claude subscription account (Pro/Max/Team/Enterprise) or a Claude Console account billed per token.
- A browser window opens. Approve the login and return to the terminal.
You can switch accounts later with the /login command. If you plan to use API billing, here is how to get a Claude API key.
Step 4: Run your first task
Start with something safe and read-only to see how Claude Code thinks:
- “Give me an overview of this codebase: main folders, entry points and how data flows.”
- “Where is user authentication handled? List the relevant files.”
Then try a small change:
- “Add input validation to the signup form and write a test for it.”
- “Fix the failing test in tests/test_orders.py and explain the cause.”
Claude Code will propose edits and ask permission before changing files or running commands. Review each step, especially commands that install packages or touch production systems.
Step 5: Create a CLAUDE.md file
Run /init inside a project. Claude Code scans the repository and creates a CLAUDE.md file that describes your project, build commands, test commands and coding conventions. Claude reads this file at the start of every session, so it stops guessing how to run your tests. Edit it by hand to add rules such as “Use pnpm, not npm” or “Never edit files in /generated”.
Useful commands to know
| Command | What it does |
|---|---|
/help |
Lists available commands |
/init |
Creates a CLAUDE.md for the project |
/model |
Switches the Claude model |
/clear |
Starts a fresh conversation |
/compact |
Summarises a long session to free up context |
/permissions |
Controls which tools and commands are allowed |
/login and /logout |
Switch accounts |
claude -c |
Continues your most recent conversation |
claude -p "prompt" |
Runs a single prompt non-interactively, useful in scripts |
Using Claude Code in VS Code, JetBrains and desktop
- VS Code and forks such as Cursor: install the Claude Code extension from the marketplace. You get a side panel, inline diffs and the ability to share your current selection with Claude.
- JetBrains IDEs: install the Claude Code plugin; it connects to the CLI and shows diffs in the IDE.
- Claude desktop app and web: run coding sessions without a terminal, including in the cloud on your GitHub repositories. See our Claude desktop app guide.
Fixing common installation problems
| Problem | Fix |
|---|---|
claude: command not found |
Restart the terminal. If it persists, make sure the install location (often ~/.local/bin) is on your PATH. |
| npm EACCES permission errors | Do not use sudo. Switch to the native installer or configure a user-level npm prefix. |
| Windows: Git Bash not found | Install Git for Windows, then rerun the installer, or use WSL. |
| Login page does not open | Copy the URL shown in the terminal into your browser manually. |
| Two versions installed | Run claude doctor, then uninstall the npm version with npm uninstall -g @anthropic-ai/claude-code. |
| Corporate proxy blocks requests | Set the HTTPS_PROXY environment variable as described in Anthropic’s network configuration docs. |
Safety tips for agentic coding
- Commit your work before big tasks so you can roll back easily.
- Keep the default permission prompts on until you trust a workflow.
- Never let any AI agent handle production credentials; use environment variables and secrets managers.
- Review diffs like you would review a colleague’s pull request.
Claude Code vs other coding agents
Claude Code competes with OpenAI’s Codex, Cursor’s agent, GitHub Copilot’s agent mode and Google’s Gemini CLI. If you are deciding between them, read Codex vs Claude Code, check Cursor pricing or browse the best AI coding tools.
FAQ
Is Claude Code free?
No. Claude Code requires a paid Claude plan (Pro or higher) or pay-as-you-go API credits through the Claude Console.
Do I need Node.js to install Claude Code?
Not with the native installer. Node.js 18+ is only needed if you install via npm.
Does Claude Code work on Windows?
Yes. You can install it natively with PowerShell (Git for Windows is required) or inside WSL.
How do I update Claude Code?
Native installs update automatically. You can also run claude update. Homebrew users run brew upgrade claude-code.
How do I uninstall Claude Code?
For npm installs, run npm uninstall -g @anthropic-ai/claude-code. For native installs, follow the uninstall steps in Anthropic’s documentation, which remove the binary and the ~/.claude settings folder if you choose.
Browse our curated directory of AI tools by category.