To install Claude Code, use one of the following methods:
**macOS, Linux, WSL:**
theme
1
curl -fsSL https://claude.ai/install.sh | bash
**Windows PowerShell:**
theme
1
irm https://claude.ai/install.ps1 | iex
**Windows CMD:**
theme
1
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
If you see `The token '&&' is not a valid statement separator`, you're in PowerShell, not CMD. If you see `'irm' is not recognized as an internal or external command`, you're in CMD, not PowerShell. Your prompt shows `PS C:\` when you're in PowerShell and `C:\` without the `PS` when you're in CMD.
[Git for Windows](https://git-scm.com/downloads/win) is recommended on native Windows so Claude Code can use the Bash tool. If Git for Windows is not installed, Claude Code uses PowerShell as the shell tool instead. WSL setups do not need Git for Windows.
<Info>
Native installations automatically update in the background to keep you on the latest version.
</Info>
theme
1
brew install --cask claude-code
Homebrew offers two casks. `claude-code` tracks the stable release channel, which is typically about a week behind and skips releases with major regressions. `claude-code@latest` tracks the latest channel and receives new versions as soon as they ship.
<Info>
Homebrew installations do not auto-update. Run `brew upgrade claude-code` or `brew upgrade claude-code@latest`, depending on which cask you installed, to get the latest features and security fixes.
</Info>
theme
1
winget install Anthropic.ClaudeCode
<Info>
WinGet installations do not auto-update. Run `winget upgrade Anthropic.ClaudeCode` periodically to get the latest features and security fixes.
</Info>
You can also install with apt, dnf, or apk on Debian, Fedora, RHEL, and Alpine.
步骤 2:登录您的账户
Claude Code 需要账户才能使用。使用 claude 命令启动交互式会话,首次使用时系统会提示您登录:
theme
1
claude
对于 Claude 订阅或 Console 账户,请按照提示在浏览器中完成身份验证。要稍后切换账户或重新身份验证,请在运行的会话中输入 /login: