tools.ceo

How to install Claude Code safely on macOS, Linux, and Windows

The current official installation routes, verification commands, login steps, and a safe first-project workflow.

AIUpdated August 28, 20264 min readBy tools.ceo editorial

Code and tools on a screen
Photo: Unsplash

The short answer

Use Anthropic’s native installer or an official package-manager route, then verify the installation with `claude --version` and `claude doctor`. Run `claude` inside a version-controlled project and follow the browser login flow. Windows users can run Claude Code natively or through WSL. Avoid `sudo npm install -g`; the npm route remains available, but Anthropic’s current documentation presents native and operating-system package options directly.

  • Install from Anthropic’s official Claude Code documentation, not a copied third-party command.
  • Verify the binary with `claude --version` and diagnose setup with `claude doctor`.
  • Start in a clean Git repository and review permissions before allowing changes or commands.
  • Never paste API keys, customer data, or `.env` contents into the session.

The shortlist

Claude Code

Best for working with Claude directly from a project and terminal

Anthropic’s agentic coding tool for inspecting files, editing code, running commands, and supporting development workflows.

Before you install

Confirm that your operating system and account are supported on Anthropic’s current setup page. Claude Code requires internet access for authentication and AI processing. You should also have Git installed and know how to restore the project you are about to use. Installation gives the agent no automatic licence to change production systems; repository permissions and the approvals you grant during a session still matter. Sources: Official Claude Code setup

Install on macOS

Anthropic documents a native installer and Homebrew casks. If you use Homebrew, `brew install --cask claude-code` follows the stable channel, while `claude-code@latest` follows the newest release channel. Homebrew installations are updated with `brew upgrade` rather than Claude Code’s background updater. Use the exact command shown in the official documentation when you install, because channels and prerequisites can change.

Install on Linux

Use the native Linux installer or the signed package repository documented for Debian/Ubuntu, Fedora/RHEL, or Alpine. Package-manager installations follow the normal operating-system upgrade workflow. On specialised distributions, read the prerequisites rather than assuming a generic shell command will work; Anthropic documents additional runtime packages for Alpine and other musl-based systems.

Install on Windows

Claude Code can run natively on Windows or inside WSL. Anthropic documents WinGet with `winget install Anthropic.ClaudeCode`; WinGet installations require normal package upgrades. Native Windows can use PowerShell, while installing Git for Windows enables the Bash tool. If your project lives inside a WSL filesystem, install and run Claude Code inside that distribution so file paths and development tools stay consistent.

The npm alternative

The global npm package is installed with `npm install -g @anthropic-ai/claude-code`. Anthropic’s current documentation says the npm package requires Node.js 22 or later and warns against using `sudo` for the global install. If npm reports a permissions problem, fix the npm configuration or choose another official installation method rather than elevating the package install. Sources: Claude Code installation methods

Verify and sign in

Run `claude --version`, then `claude doctor` for a deeper configuration check. Change into your repository and run `claude`; follow the browser prompts for an eligible Claude or Console account, or use an organisation-approved enterprise provider configuration. Account availability and entitlements change, so verify them on the current official setup page rather than relying on an old tutorial.

Your first safe session

Commit or stash existing changes. Ask Claude Code to inspect the repository, explain its understanding, and propose a plan for one small task. Supply the test command and acceptance criteria. Review the diff and command output before committing. Keep secrets out of prompts, use least-privilege credentials, and do not approve a command you do not understand.

No affiliate links on this page at publication. Product names link to official sites so you can check current pricing. How we work.

Keep reading.

New guides, about once a fortnight.

Websites, security and AI for people who pay for the software. One email when something is worth your time, nothing else.

Free. Unsubscribe from any email.