How to Install Claude Code — A Step-by-Step Guide



How to Install Claude Code — A Step-by-Step Guide

Claude Code is Anthropic's official AI-powered coding assistant that runs directly in your terminal. Unlike browser-based AI tools, Claude Code operates inside your development environment — it can read your files, run commands, edit code, manage Git, and work across your entire codebase in a single session. This guide walks you through everything you need to install and run it.

Prerequisites

Before installing Claude Code, make sure you have the following in place:

  • Node.js 18 or later — Claude Code is distributed as an npm package and requires Node.js. Download the latest LTS version from nodejs.org if you do not already have it. Verify your version by running node --version in your terminal.

  • An Anthropic account — You need an API key from Anthropic to use Claude Code. Sign up at console.anthropic.com and generate an API key from the API Keys section of your account dashboard.

  • A terminal — Terminal on macOS, Command Prompt or PowerShell on Windows, or any Linux shell. Claude Code works on macOS, Windows (via WSL2 or natively), and Linux.


Step 1: Install Claude Code via npm

Claude Code is installed globally as an npm package. Open your terminal and run:

npm install -g @anthropic-ai/claude-code

The -g flag installs it globally so the claude command is available from any directory on your system. The installation typically completes in under a minute. Once done, verify the installation with:

claude --version

Step 2: Authenticate with Your Anthropic API Key

Claude Code needs your Anthropic API key to make requests. The recommended approach is to set it as an environment variable so it is available automatically in every terminal session.

On macOS and Linux, add the following line to your shell configuration file (~/.zshrc, ~/.bashrc, or ~/.bash_profile):

export ANTHROPIC_API_KEY="your-api-key-here"

Then reload your shell configuration:

source ~/.zshrc

On Windows, set the environment variable via System Properties → Environment Variables, or use PowerShell:

$env:ANTHROPIC_API_KEY="your-api-key-here"

Alternatively, when you run claude for the first time without an API key set, it will prompt you to enter one interactively and guide you through the authentication flow.


Step 3: Run Claude Code for the First Time

Navigate to any project directory and start Claude Code by running:

claude

This opens an interactive session in your terminal. You can immediately start giving Claude instructions in plain English — ask it to explain code, fix a bug, write tests, or refactor a function. Claude Code reads your project files directly and responds with awareness of your actual codebase.

To run a one-off task without entering the interactive session, pass your prompt directly as an argument:

claude "explain what this project does"

Step 4: IDE Integration (Optional)

Claude Code integrates with popular IDEs so you can use it without leaving your editor.

  • VS Code — Install the Claude Code extension from the VS Code Marketplace. It adds a Claude Code panel to your sidebar and lets you open sessions directly from the editor.

  • JetBrains IDEs (IntelliJ, WebStorm, PhpStorm, etc.) — Install the Claude Code plugin from the JetBrains Marketplace to get the same integrated experience inside your JetBrains IDE.

Both integrations keep Claude Code's terminal running behind the scenes — the IDE simply provides a more convenient interface.

Keeping Claude Code Updated

Anthropic releases updates to Claude Code regularly. To update to the latest version, run the same install command with the @latest tag:

npm install -g @anthropic-ai/claude-code@latest

Claude Code may also prompt you to update automatically when a new version is available at the start of a session. With Node.js installed and your API key configured, you are ready to start using one of the most capable AI coding tools available directly from your terminal. Read our getting started guide to learn how to make the most of it.


Get in Touch

You need more information? Email me at [email protected]