Skip to content

Install Claude Code ​

Claude Code is an AI-powered coding assistant that can understand a project, edit multiple files, and use development tools. It works in the terminal and can be paired with IDE and desktop experiences.

This page covers the native installer, Homebrew, WinGet, and npm. After installation, connect the client with a LAYSO AI API key.

Requirements ​

  • A valid LAYSO AI API key; no separate Claude subscription is required for the LAYSO AI connection.
  • macOS 13+, Ubuntu 20.04+/Debian 10+, Windows 10 1809+, or a corresponding WSL environment.
  • Git for Windows on Windows.
  • Node.js 18 or newer only when using npm.

Terminal CLI ​

The native installer does not require Node.js and checks for updates automatically.

macOS / Linux / WSL:

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

Windows PowerShell:

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

Windows CMD:

bat
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

PowerShell and CMD use different commands

If you see The token '&&' is not a valid statement separator, you are in PowerShell. Use the PowerShell command above.

Homebrew ​

For macOS:

bash
brew install --cask claude-code

Homebrew installations do not update automatically by default:

bash
brew upgrade claude-code

WinGet ​

For Windows:

powershell
winget install Anthropic.ClaudeCode

WinGet installations do not update automatically by default:

powershell
winget upgrade Anthropic.ClaudeCode

npm ​

npm requires Node.js 18 or newer:

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

Do not use sudo npm install -g; it can cause permission and security issues.

Choose a release ​

The native installer accepts latest, stable, or a specific version. The default is latest.

Stable release ​

macOS / Linux / WSL:

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

Windows PowerShell:

powershell
& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) stable

Windows CMD:

bat
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd stable && del install.cmd

Specific version ​

Replace <VERSION> with the required release:

bash
curl -fsSL https://claude.ai/install.sh | bash -s <VERSION>
powershell
& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) <VERSION>
bat
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd <VERSION> && del install.cmd

Verify the installation ​

Reopen the terminal, then run:

bash
claude --version
claude doctor

A version number confirms that installation succeeded.

Start your first session ​

bash
cd /path/to/your-project
claude

Review directory and permission prompts carefully. Do not allow automatic execution in an untrusted directory.

Update and uninstall ​

Update ​

InstallationUpdate command
NativeAutomatic background updates, or claude update
Homebrewbrew upgrade claude-code
WinGetwinget upgrade Anthropic.ClaudeCode
npmnpm install -g @anthropic-ai/claude-code@latest

Uninstall package-manager versions ​

bash
brew uninstall --cask claude-code
npm uninstall -g @anthropic-ai/claude-code

Windows:

powershell
winget uninstall Anthropic.ClaudeCode

Installation troubleshooting ​

Command not found ​

Reopen the terminal. If the command is still missing, verify that ~/.local/bin or npm's global executable directory is on PATH.

npm binary is missing ​

Make sure npm allows optional dependencies and that the platform and CPU architecture are supported:

bash
npm list -g --depth=0

Windows startup issues ​

Install Git for Windows and retry in a new PowerShell or CMD window. WSL users should run the Linux installation command inside WSL.

Next step ​

Continue to Claude Code model endpoint setup and connect LAYSO AI with the root address https://api.layso.ai.

LAYSO AI API 文档