# Setting Up Claude Code on macOS, Windows and Linux

_Install Claude Code, sign in, give it project context, and use it to build a tested TypeScript utility._

This tutorial covers the full Claude Code setup: the install command for your operating system, sign-in, project instructions, and one complete coding task. You will plan a change, review the plan, let Claude edit the files, run tests, and inspect the diff. That review loop is [human-in-the-loop development](/learn/concepts/ai-engineering/human-in-the-loop-development) in miniature.

Commands and requirements on this page come from the [Claude Code setup docs](https://code.claude.com/docs/en/setup) and [quickstart](https://code.claude.com/docs/en/quickstart), checked in December 2026.

## Before You Begin

You need:

- **An operating system Claude Code supports**: macOS 13.0 or later, Windows 10 1809 or later, Windows Server 2019 or later, Ubuntu 20.04 or later, Debian 10 or later, or Alpine Linux 3.19 or later.
- **4 GB of RAM or more** and an x64 or ARM64 processor.
- **An account with Claude Code access**: a Claude Pro, Max, Ultra, Team or Enterprise plan, a Claude Console account, or access through Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry. The free Claude plan does not include Claude Code.
- **A local Git repo** with a working TypeScript test command, for the task later in this tutorial.

## Install Claude Code on macOS and Linux

Open a terminal and run the native installer. The same command works inside WSL on Windows:

```bash
curl -fsSL https://claude.ai/install.sh | bash
```

The installer prints no progress while it downloads. When it finishes, open a new terminal window so your shell picks up the new `claude` command. Native installs update themselves in the background.

On macOS you can use Homebrew instead:

```bash
brew install --cask claude-code
```

The `claude-code` cask follows the stable channel, which runs about a week behind and skips releases with major regressions. Homebrew installs do not update themselves. Run `brew upgrade claude-code` to get new versions.

On Linux, Anthropic also publishes signed apt, dnf and apk repositories for Debian, Ubuntu, Fedora, RHEL and Alpine. Those packages update through your normal system upgrades. The [Linux package manager instructions](https://code.claude.com/docs/en/setup#install-with-linux-package-managers) list the repository lines and signing key fingerprint. Alpine needs `bash` and `curl` before the native installer runs, so install them first with `apk add bash curl`.

## Install Claude Code on Windows

Claude Code for Windows runs natively or inside WSL. Pick based on where your projects live:

| Option | Sandboxing | Use it for |
| --- | --- | --- |
| Native Windows | Not supported | Windows-native projects and tools |
| WSL 2 | Supported | Linux toolchains, or sandboxed command execution |
| WSL 1 | Not supported | Machines where WSL 2 is unavailable |

For a native install, run one of these. You do not need an Administrator prompt. Your prompt starts with `PS` in PowerShell and without it in CMD.

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

```batch
:: CMD
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
```

WinGet works too, but it does not update Claude Code for you. Run `winget upgrade Anthropic.ClaudeCode` when you want a new version.

```powershell
winget install Anthropic.ClaudeCode
```

Install [Git for Windows](https://git-scm.com/downloads/win) as well. It is optional, but it provides Git Bash, which Claude Code's Bash tool needs. Without it, Claude Code runs shell commands through PowerShell.

For WSL, open your Linux distribution and run the macOS and Linux installer from the previous section. You then start `claude` inside the WSL terminal, not from PowerShell or CMD.

## Verify the Install

Check that your shell finds the command:

```bash
claude --version
```

A working install prints a version number followed by `(Claude Code)`. If the shell reports that `claude` is not found, the install directory is not on your `PATH` yet. Open a new terminal, then see [Troubleshoot installation](https://code.claude.com/docs/en/troubleshoot-install) if the error remains.

For a fuller check, `claude doctor` prints install health, settings-file errors and the result of the last auto-update without starting a session.

## Sign In

Start Claude Code from your project directory:

```bash
cd /path/to/your/project
claude
```

On first use, Claude Code asks you to log in. Complete the sign-in in your browser with your Claude plan or Console account. Claude Code stores the login, so later sessions start straight away. If `ANTHROPIC_API_KEY` is set and you approve the key when asked, Claude Code skips the browser login.

To switch accounts later, type `/login` inside a running session.

## Add the VS Code Extension

The VS Code extension needs VS Code 1.94 or later. Open the Extensions view with `Cmd+Shift+X` on macOS or `Ctrl+Shift+X` on Windows and Linux, search for **Claude Code**, and install the extension published by Anthropic.

Open a source file and click the Spark icon in the editor toolbar. The first time the panel opens, it shows a sign-in screen that completes in your browser. If the panel does not appear, run **Developer: Reload Window** from the Command Palette.

The extension bundles its own copy of Claude Code for the chat panel. It does not put `claude` on your shell `PATH`, so install the standalone CLI as well if you want to run `claude` in a terminal.

Anthropic also ships a desktop app and a web UI. [Claude Code GUI options](/compare/claude-code-gui) compares them with third-party apps.

## Add Project Instructions

Claude Code reads `CLAUDE.md` files at the start of every session. A project file lives at `./CLAUDE.md` or `./.claude/CLAUDE.md` and goes into version control. Personal instructions for every project go in `~/.claude/CLAUDE.md`.

Run `/init` in a session to generate a starting `CLAUDE.md`. Claude reads the codebase and writes the build commands, test commands and conventions it finds. If the file already exists, `/init` suggests improvements instead of overwriting it.

If your team also uses other [coding agents](/learn/concepts/ai-engineering/coding-agents), keep shared rules in `AGENTS.md`:

```markdown
# Project instructions

## Commands
- Install dependencies: `npm install`
- Run tests: `npm test`
- Type check: `npm run typecheck`

## Code style
- Use TypeScript strict mode
- Keep utility functions small
- Add unit tests for new behavior
```

Then import it from `CLAUDE.md` and add guidance only Claude Code needs:

```markdown
@AGENTS.md

## Claude Code notes
- Place utilities in `src/lib/`
- Match the test patterns in `test/`
- Ask before changing CI or deployment files
```

The import matters. When a `CLAUDE.md` exists, Claude Code reads it instead of `AGENTS.md`, so the `@AGENTS.md` line is what pulls the shared rules in. Run `/context all` and check the **Memory files** list to confirm both loaded.

## How to Use Claude Code: Your First Session

Start by asking about the code. Claude reads files as it needs them, so you do not have to paste context:

```text
what does this project do? where are the tests?
```

The session's **permission mode** decides which actions Claude takes without asking you first. Press `Shift+Tab` in the terminal to cycle modes, or click the mode indicator under the prompt box in VS Code. This tutorial uses three:

| Mode | What Claude does |
| --- | --- |
| Plan | Explores the repo and proposes a plan, but does not edit files |
| Accept edits | Edits files in your workspace without asking for each change |
| Manual | Asks before file edits and most shell commands |

Claude Code v2.1.283 and later start terminal and VS Code sessions in auto mode, where a classifier reviews most actions instead of asking you. The [permission modes reference](https://code.claude.com/docs/en/permission-modes) lists every mode and when each one is available.

## Plan the Change

Switch to Plan mode and send:

```text
Add a formatDate utility at src/lib/formatDate.ts.
It accepts an ISO date string and returns a date such as "Jan 5, 2026".
Add tests at test/formatDate.test.ts for valid and invalid input.
Inspect the existing code and plan the change before editing files.
```

Review the plan as a change contract. Check the target files, public behavior, invalid input case and test command. Reply with corrections if Claude made a wrong assumption, and approve the plan once it matches the task.

## Implement and Refine

Switch to Accept edits and send:

```text
Implement the approved plan. Run the relevant tests and type checks.
```

Watch the edits and command output. Claude should create the utility and test files without changing unrelated code.

For follow-ups about known code, reference the file with `@`. In VS Code, select lines and press `Option+K` on macOS or `Alt+K` on Windows and Linux to insert the reference:

```text
@src/lib/formatDate.ts Return null for an invalid date string.
Update the tests to define this behavior.
```

## Verify and Review the Diff

Run the checks yourself:

```bash
npm test
npm run typecheck
```

Read the new tests before you trust the green result. They should cover a valid date, an invalid string that returns `null`, and output that does not change with the machine's time zone. Date formatting often shifts across time zones, so the contract needs an explicit time zone or a date-only parsing rule.

Switch to Manual mode for the final pass and review every changed file. Look for unrelated edits, weak assertions, new dependencies and behavior the plan did not cover. Ask Claude to summarize each changed file if the diff is larger than you expected. The summary helps you navigate, but the diff remains the source of truth.

## Essential Commands

| Command | What it does |
| --- | --- |
| `claude` | Start an interactive session |
| `claude "task"` | Start a session with a first prompt |
| `claude -p "query"` | Run one query, print the answer, and exit |
| `claude -c` | Continue the most recent conversation in this directory |
| `claude -r` | Resume an earlier conversation |
| `/clear` | Start a new conversation inside the session |
| `/help` | List available commands |
| `/exit` | Leave Claude Code |

Native installs update in the background. Run `claude update` to apply an update immediately.

## Next Steps

- [How to Run Multiple Claude Code Sessions](/learn/how-to/how-to-run-multiple-claude-code-sessions): give each session its own worktree so parallel tasks do not collide
- [How to Review Code with Claude Code](/learn/how-to/claude-code-review): review a pull request or local diff with Claude
- [How to Fix Merge Conflicts Created by Coding Agents](/learn/how-to/merge-conflicts-with-coding-agents): prevent and resolve conflicts between agent branches
- [AI Feature Development Workflow](/learn/workflows/ai/ai-feature-development): scope a bounded feature task for an agent
- [Claude Code vs Codex](/compare/claude-code-vs-codex-cli): compare Claude Code with OpenAI's terminal agent
