OctoLink GEO

A Comprehensive Guide to Installing Claude Code on macOS, Linux, and Windows WSL

Author Editor
A Comprehensive Guide to Installing Claude Code on macOS, Linux, and Windows WSL

Step-by-step instructions to set up Claude Code—Anthropic’s AI-powered CLI tool—across macOS, Linux, and Windows WSL, including prerequisites...

Claude Code AI Development Tools Installation Guide macOS Linux Windows WSL Node.js Anthropic API

If you’re aiming to use Claude Code, Anthropic’s AI-driven command-line tool for code assistance, this guide covers installation for three major environments with clear, actionable steps. We’ll start with essential prerequisites before diving into OS-specific setup.

Prerequisites

Before installing Claude Code, ensure your system meets these requirements:

1. **Node.js 18+**: Claude Code is built on Node.js. Check your version with `node -v`; use nvm (Node Version Manager) to upgrade if needed.

2. **npm or Yarn**: These package managers come with Node.js—verify with `npm -v`.

3. **Git**: Required for code tracking and diff generation. Install via `brew install git` (macOS) or `apt install git` (Linux) if missing.

4. **Stable Proxy**: Claude Code communicates with Anthropic’s API. Users in regions with connectivity issues should set up a proxy to avoid timeouts.

macOS Installation

macOS users can install Claude Code with one global command:

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

Verify installation with `claude --version` (output like `claude-code v1.x.x`). First run `claude` in your project directory to complete setup: log into your Anthropic account (via browser), choose a billing method (API Key or Pro subscription), and set permission levels (default: manual approval).

Linux Installation

Use the same command as macOS: `npm install -g @anthropic-ai/claude-code`. Note these Linux-specific tips:

• **Permissions**: Avoid `sudo`—use nvm to manage Node.js (installs packages in your user directory). If you have Node without nvm, configure npm’s global path manually.

• **Fonts**: Use a terminal that supports Unicode (e.g., Kitty, iTerm2) for proper UI rendering.

• **GUI-less Auth**: If no browser is available, Claude Code provides a manual link—copy to a device with a browser to log in.

Windows Installation via WSL

Claude Code lacks a native Windows version, but WSL works seamlessly:

1. **Install WSL**: Open PowerShell as admin and run `wsl --install` (installs WSL2 + Ubuntu). Restart and set up a username/password.

2. **Install Node.js**: In WSL terminal, install nvm: `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash`, then `nvm install 18`.

3. **Install Claude Code**: Run `npm install -g @anthropic-ai/claude-code` and verify with `claude --version`.

4. **Optimal Workflow**: Clone projects to WSL’s home directory (avoid Windows file system for speed). Use VS Code’s Remote-WSL plugin to edit files on Windows while running Claude Code in WSL.

5. **Login**: First run `claude` auto-launches your Windows browser for OAuth.

Sources

Related reading