Skip to content
AI14 min read

How to use Claude Code: install, set up and build your first project, step by step

A hands-on guide to Claude Code from the first install command to your first commit: every official install and update method, VS Code, CLAUDE.md, permission modes, rewinding mistakes and fixing common problems.

By

Editor

Published

Updated

Cover image for “How to use Claude Code”: Install, setup and a first project, illustrated with a terminal window.

The short answer

To use Claude Code, install it with Anthropic's native installer, open a terminal in your project folder, run `claude` and sign in with a paid Claude plan or Console account. Then describe tasks in plain English. Claude reads your code, proposes edits, runs commands and asks permission based on your permission mode. Add a CLAUDE.md file for project rules and use git to review every change.

Most guides on how to use Claude Code either stop at the install command or assume you already live in a terminal. Then you hit the questions that actually slow you down: which install method to pick, why claude is "not found", whether it will edit files without asking, and how to undo a change you did not want.

This guide walks through the whole path in order: what Claude Code is, how to install and update it on each operating system, how to use it in VS Code, a first-project walkthrough from first prompt to commit, and the settings that keep it safe. Every command comes from Anthropic's official docs, checked on November 23, 2026, and we ran the CLI checks shown below on Claude Code 2.1.330 on Linux, then retested an npm install on 2.1.332 on November 28, 2026.

What is Claude Code, and how does it work?

Claude Code is Anthropic's coding agent. Instead of pasting snippets into a chat window, you start it inside a project and describe what you want. It reads the files it needs, edits them, runs commands such as tests or git, and reports back. It runs in the terminal, in VS Code and other editors, in a desktop app and on the web.

Under the hood, Anthropic describes (opens in a new tab) an agentic loop with three phases that blend together: gather context, take action and verify results. A simple question may only need the first phase. A bug fix cycles through all three repeatedly: read the code, change it, run the tests, read the failure, change it again. You can interrupt at any point with Esc, or type a correction while it works.

To do this, Claude Code has tools for file operations, search, running shell commands, web lookups and code intelligence. It can also connect to outside services through the Model Context Protocol. If you want the bigger picture of how agents like this are put together, our guide on how to build an AI agent covers the same loop from the builder's side.

Before you start: what you need

  • A paid account. Anthropic's setup page (opens in a new tab) says Claude Code requires a Pro, Max, Team, Enterprise or Console account, and the free claude.ai plan does not include it. Companies can also connect through Amazon Bedrock, Google Cloud or Microsoft Foundry.
  • A supported system. macOS 13.0 or later, Windows 10 1809 or later (or Windows Server 2019), Ubuntu 20.04+, Debian 10+ or Alpine Linux 3.19+, with 4 GB of RAM or more and an x64 or ARM64 processor.
  • A shell and an internet connection. Bash, Zsh, PowerShell or CMD all work.
  • A project folder, ideally one tracked with git so you can review and roll back changes.

You do not need Node.js for the recommended installer. Only the npm package needs it, and the setup page asks for Node.js 22 or later.

How to install Claude Code

Anthropic labels its native installer as the recommended method. It downloads a standalone binary and keeps it updated in the background. Pick the line for your system:

Native install commands from Anthropic's quickstart and setup docs
# macOS, Linux or WSL
curl -fsSL https://claude.ai/install.sh | bash

# Windows PowerShell
irm https://claude.ai/install.ps1 | iex

# Windows CMD
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

The quickstart (opens in a new tab) warns that the install command shows no progress while it downloads, so give it a minute. When it finishes, open a new terminal window so your shell picks up the new claude command.

Other ways to install it

Claude Code install methods compared
MethodInstall commandAuto-updates?Best for
Native installer (recommended)curl -fsSL https://claude.ai/install.sh | bashYes, in the backgroundMost people on any OS
Homebrew (macOS, Linux)brew install --cask claude-codeNo, unless you opt inPeople who manage all tools with Homebrew
WinGet (Windows)winget install Anthropic.ClaudeCodeNo, unless you opt inWindows users who prefer a package manager
apt, dnf or apk (Linux)sudo apt install claude-code after adding Anthropic's repositoryNoManaged Linux servers and fleets
npmnpm install -g @anthropic-ai/claude-codeNo; update with npmSetups that already standardize on npm (needs Node.js 22+)

Two details trip people up. Homebrew has two casks: claude-code tracks the stable channel, which the setup page says is "typically about a week behind" and skips releases with major regressions, while claude-code@latest gets every release. And for npm, Anthropic says not to use sudo npm install -g.

Installing on Windows

You can run Claude Code natively on Windows or inside WSL. On native Windows you do not need to run as Administrator. Anthropic recommends installing Git for Windows (opens in a new tab) so Claude Code can use its Bash tool; without it, Claude Code falls back to PowerShell. If you use WSL, run the Linux install command inside the WSL terminal and you do not need Git for Windows. WSL 2 also supports sandboxing, which native Windows does not.

Check that it worked

Run these two commands. The first prints the version. The second, claude doctor, prints read-only diagnostics about your install and settings without starting a session. Here is what they returned on our test machine:

Output from Claude Code 2.1.330 on Linux, trimmed. Your version and paths will differ.
$ claude --version
2.1.330 (Claude Code)

$ claude doctor
Claude Code doctor

Running: native (2.1.330)
Platform: linux-x64
Search: OK (/usr/bin/rg)
Auto-update channel: latest
...

What we ran into when we retested it

Five days later we installed it again through npm on a fresh Linux machine with Node.js 24, without signing in, to see what a new user hits first. The install took about five seconds and used 384 MB, most of it the bundled native program. Here is what came up:

  • The version had already moved on. We got 2.1.332, two releases after the 2.1.330 we first tested. Releases are frequent, so expect your version number to be ahead of any guide, including this one.
  • `claude doctor` warned that it could not auto-update. Its message was "Can't auto-update: npm global folder isn't writable." npm installs only update themselves if the folder npm installed into is writable by you. Fix: use the native installer, or set a user-owned npm folder; do not reach for sudo, which Anthropic advises against.
  • A network check flagged our proxy. Our test machine sits behind a corporate-style proxy. claude doctor reached the API in 145 ms but reported the sign-in host as failed with ERR_PROXY_TUNNEL, and pointed to Anthropic's network configuration page (opens in a new tab). If sign-in hangs at work, run claude doctor first: it tells you which host is blocked.
  • Scripts fail fast before you sign in. Piping into claude -p without signing in printed "Not logged in · Please run /login" and exited with code 1. If you use claude -p in a script or CI job, check the exit code so a missing login does not pass silently.

If doctor lists warnings, it prints a suggested fix under each one, such as running claude install to repair a broken launcher.

How to update Claude Code

How you update depends on how you installed it. Native installs check for updates on startup and periodically while running, and the new version takes effect the next time you start Claude Code. To update right away, run:

Update commands per install method, from Anthropic's setup docs
# Native install: check for and install an update now
claude update

# Homebrew (use the cask you installed)
brew upgrade claude-code
brew upgrade claude-code@latest

# WinGet
winget upgrade Anthropic.ClaudeCode

# apt / dnf / apk
sudo apt update && sudo apt upgrade claude-code
sudo dnf upgrade claude-code
apk update && apk upgrade claude-code

# npm (Anthropic says to avoid npm update -g)
npm install -g @anthropic-ai/claude-code@latest

In the CLI's own help text, update is described as "Check for updates and install if available; package-manager installs update through the package manager." A few related controls are worth knowing:

  • Choose a release channel. Set autoUpdatesChannel to "stable" in your settings file, or use Auto-update channel in /config, if you would rather run a version that is about a week old. The default is "latest".
  • Turn off background updates. Set the DISABLE_AUTOUPDATER environment variable to "1" under env in settings.json. Manual claude update still works. To block every update path, Anthropic says to set DISABLE_UPDATES instead.
  • Let Homebrew or WinGet upgrade automatically. Set CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE to 1. This works for those two package managers only.
  • Pin a version. The native installer accepts a channel or version number, for example curl -fsSL https://claude.ai/install.sh | bash -s stable.

How to get started with Claude Code: your first session

Open a terminal, move into a project folder and start Claude Code:

Start an interactive session in your project
cd /path/to/your/project
claude

On first run, Claude Code opens your browser so you can sign in with your Claude subscription or Console account. Credentials are stored, so you will not need to log in again. If you use a Console account, the quickstart notes that a "Claude Code" workspace is created automatically for cost tracking. To switch accounts later, type /login inside a session.

The prompt shows the version, the current model and the working directory. Type /help to list commands, or / to browse commands and skills.

Claude Code reads your project files as needed. You don't have to manually add context.
Anthropic, Claude Code quickstart

A first project walkthrough, from question to commit

Here is a practical first hour, using the same kinds of prompts Anthropic's quickstart recommends. Treat it as an example to adapt to your own project, not a script.

  1. Get oriented. Ask what does this project do?, then where is the main entry point? and explain the folder structure. Claude searches and reads files to answer. Nothing changes on disk.
  2. Create a CLAUDE.md. Run /init. Claude analyzes the codebase and writes a starting CLAUDE.md with build commands, test instructions and conventions. Read it and fix anything wrong (more on this file below).
  3. Plan before editing. Press Shift+Tab until the status bar shows ⏸ plan mode on, then describe a small change, such as add input validation to the signup form. In plan mode Claude researches and proposes changes without making them.
  4. Approve and let it work. When the plan looks right, approve it. You can choose to approve edits manually or let it continue in auto mode. Watch the diffs as they appear.
  5. Make it prove the change works. Ask write unit tests for the validation and run them. A change that comes with passing tests is far easier to trust.
  6. Review and commit. Ask what files have I changed?, read the diff yourself, then commit my changes with a descriptive message. On a team, follow with create a pr.

If you are new to writing instructions for Claude, our guide to Claude prompt engineering covers the techniques that work best with Anthropic's models.

Commands you will use every day

Essential Claude Code commands
CommandWhereWhat it does
claudeTerminalStart an interactive session in the current folder
claude "task"TerminalStart a session with a first prompt
claude -p "query"TerminalAnswer one query and exit, useful in scripts and pipes
claude -cTerminalContinue the most recent conversation in this folder
claude -rTerminalPick a previous conversation to resume
claude --permission-mode planTerminalStart in plan mode
/initIn a sessionGenerate a starting CLAUDE.md
/compactIn a sessionSummarize the conversation to free up context
/clearIn a sessionClear conversation history and start fresh
/rewind or Esc twiceIn a sessionRestore code or conversation to an earlier checkpoint
Shift+TabIn a sessionCycle permission modes
/exit or Ctrl+D twiceIn a sessionQuit

Because claude -p reads standard input, it slots into ordinary shell pipelines. The common workflows (opens in a new tab) page gives this example:

Piping git output into Claude Code
git log --oneline -20 | claude -p "summarize these recent commits"

How to use Claude Code in VS Code

If you prefer a graphical panel to the terminal, install the official extension. According to Anthropic's VS Code docs (opens in a new tab), you need VS Code 1.94.0 or higher and the same paid Claude or Console account. No API key is required.

  1. Press Cmd+Shift+X on Mac or Ctrl+Shift+X on Windows and Linux to open Extensions, search for "Claude Code" by Anthropic and click Install. The same extension installs in Cursor and other VS Code forks, or from the Open VSX registry.
  2. Open a file, then click the Spark icon in the editor toolbar at the top right. You can also open the Command Palette and choose Claude Code: Open in New Tab.
  3. Click Sign in the first time. If you see "Not logged in · Please run /login", run Developer: Reload Window from the Command Palette.
  4. Type a request. Use @ to mention a file or folder, such as @src/components/, or select code first and it is sent along automatically. Option+K on Mac or Alt+K on Windows and Linux inserts a reference to the selected lines.
  5. Review the side-by-side diffs Claude proposes and accept or reject each change.

Cmd+Esc on Mac or Ctrl+Esc on Windows and Linux toggles focus between your code and Claude. Each tab is its own conversation, and the extension shares conversation history with the CLI. The extension bundles its own copy of Claude Code, so if you also want to run claude in VS Code's integrated terminal, install the standalone CLI too. A few CLI features, such as the ! shortcut for running bash commands and tab completion, are not available in the extension.

Comparing editors as well? Our Claude Code vs Cursor guide explains how Claude Code fits alongside an AI-first editor.

Teach it your project with CLAUDE.md

A CLAUDE.md file holds standing instructions that Claude reads at the start of every session. The memory docs (opens in a new tab) list where these files can live:

Where CLAUDE.md files go and who they apply to
FileScopeShare it?
./CLAUDE.md or ./.claude/CLAUDE.mdThis project, for everyoneYes, commit it to the repo
./CLAUDE.local.mdThis project, just youNo, add it to .gitignore
~/.claude/CLAUDE.mdAll your projectsNo, personal
Managed policy fileEveryone in an organizationSet by IT

Anthropic's guidance is to target under 200 lines per file and to write instructions that are concrete enough to verify: "Use 2-space indentation" rather than "Format code properly". Put in the facts Claude needs every session, such as build commands, conventions and project layout. You can pull in other files with @path imports. A short example:

An illustrative CLAUDE.md for a TypeScript project
# Project notes for Claude

See @README.md for the overview and @package.json for scripts.

## Commands
- Install: npm ci
- Test: npm test (run before every commit)
- Lint: npm run lint

## Conventions
- TypeScript strict mode, 2-space indentation
- New API routes go in src/routes/, one file per resource
- Never edit files in src/generated/

CLAUDE.md is guidance, not a lock. The docs say Claude treats it "as context, not enforced configuration", so anything that must never happen belongs in permission rules or hooks. Longer procedures you repeat, like a release checklist, fit better as Claude skills, which load only when needed.

Permission modes: how much Claude can do without asking

The permission mode decides which actions run without your approval. Press Shift+Tab to cycle through them during a session, or start with --permission-mode. The permission modes page (opens in a new tab) lists six:

Claude Code permission modes from least to most autonomy: plan, manual, accept edits, auto and bypass, plus don't ask mode for locked-down scripted runs.
Claude Code's permission modes, ordered by how much runs without asking.
Claude Code permission modes
ModeWhat runs without askingUse it when
Manual (default)Reads onlyYou want to approve every edit and command
Accept edits (acceptEdits)Reads, file edits and common file commands such as mkdir and mvYou trust the plan and will review the diff afterwards
Plan (plan)Reads; Claude proposes changes without making themStarting any non-trivial task
Auto (auto)Everything, with background safety checksRoutine work where constant prompts slow you down
Don't ask (dontAsk)Only pre-approved tools; anything else is deniedLocked-down scripted runs
Bypass (bypassPermissions)EverythingIsolated containers and VMs only

The VS Code docs note that Auto is the built-in starting mode on Pro, Max and Team plans, so check the mode indicator before your first request. Anthropic is clear about its limits: "Auto mode reduces permission prompts but does not guarantee safety." Bypass mode, also triggered by --dangerously-skip-permissions, should only be used in isolated environments without internet access. Our guide to agentic AI security explains why prompt injection makes broad permissions risky.

Undo mistakes with checkpoints

Every prompt creates a checkpoint. Press Esc twice with an empty prompt, or run /rewind, to restore the code, the conversation or both to an earlier point. The checkpointing docs (opens in a new tab) spell out the limits: only edits made by Claude's file editing tools are tracked, files changed only through bash commands are not, and actions on remote systems such as databases, APIs and deployments cannot be rewound. Checkpoints are for quick recovery inside a session. Git is still your real history.

Troubleshooting common problems

Common Claude Code problems and fixes
ProblemLikely causeFix
claude: command not found after installingThe install folder is not on your PATH yetOpen a new terminal; if it persists, follow the "Fix your PATH" steps in Anthropic's docs
Login fails or Claude Code is unavailableFree claude.ai planUse a Pro, Max, Team, Enterprise or Console account
Old version keeps running after an updatePackage-manager install, or two installs on one machineUpdate through your package manager and run claude doctor to see which binary is running
Bash tool unavailable on WindowsGit for Windows not installedInstall Git for Windows, or use WSL
VS Code says "Not logged in"Extension session not refreshedRun Developer: Reload Window
Claude forgets earlier instructions in a long sessionThe context window filled and was compactedPut lasting rules in CLAUDE.md, use /compact with a focus, or /clear between tasks

For anything else, start with claude doctor in your terminal or /doctor inside a session. The in-session version can also fix some issues for you.

The bottom line

Learning how to use Claude Code comes down to a short routine: install it with the native installer, start claude in a git-tracked project, plan first, ask for tests, review the diff and commit. Add a CLAUDE.md once the basics feel natural, choose a permission mode you are comfortable with, and keep claude update and claude doctor in your back pocket. For more plain-English guides to AI tools, browse our AI guides.

Common questions

Is Claude Code free to use?

No. Anthropic's setup docs say Claude Code requires a Pro, Max, Team, Enterprise or Console account, and the free claude.ai plan does not include it.

How do I update Claude Code?

Native installs update themselves in the background, and you can force a check with `claude update`. Homebrew, WinGet, apt, dnf and apk installs do not auto-update by default, so use your package manager, for example `brew upgrade claude-code` or `winget upgrade Anthropic.ClaudeCode`.

Do I need Node.js to install Claude Code?

Not for the recommended native installer, which ships its own binary. Only the npm package needs Node.js, version 22 or later according to Anthropic's setup page.

Can I use Claude Code in VS Code?

Yes. Install the Claude Code extension by Anthropic from the Extensions view (VS Code 1.94.0 or higher), then click the Spark icon or press `Cmd+Esc` on Mac or `Ctrl+Esc` on Windows and Linux. The extension shares conversation history with the CLI.

How do I undo something Claude Code changed?

Press `Esc` twice with an empty prompt, or run `/rewind`, to restore code, conversation or both to an earlier checkpoint. Checkpoints only track edits made by Claude's file tools, so keep committing to git and never rely on rewind for databases, deployments or other remote actions.

How does Claude Code work?

It runs an agentic loop: it gathers context by reading and searching your files, takes action by editing files and running commands, then verifies the result, for example by running tests. It repeats the loop until the task is done or you interrupt with `Esc`.

Sources

  1. Quickstart, Anthropic, Claude Code Docs
  2. Advanced setup, Anthropic, Claude Code Docs
  3. How Claude Code works, Anthropic, Claude Code Docs
  4. Common workflows, Anthropic, Claude Code Docs
  5. Use Claude Code in VS Code, Anthropic, Claude Code Docs
  6. How Claude remembers your project, Anthropic, Claude Code Docs
  7. Choose a permission mode, Anthropic, Claude Code Docs
  8. Checkpointing, Anthropic, Claude Code Docs
  9. Network configuration, Anthropic, Claude Code Docs

Revision history

  • : Retested an npm install on Claude Code 2.1.332 and added what we ran into: the auto-update warning, a proxy sign-in failure and how claude -p behaves before you sign in.

About A. Farooq

Qualified software engineer with 4+ years of experience in the software industry

A. Farooq is a qualified software engineer with 4+ years of experience in the software industry. A. Farooq edits GeeklyPlug and writes many of its AI and technology guides, from how AI agents are built to which laptop to buy and when. Every article lists its sources and shows when it was last updated; corrections go on the original piece.

claude codeai coding toolscoding agentshow-tovs code

Keep reading

More from AI, then the rest of the archive.