Claude Code Install
Before official installation, let's first understand the different ways to use Claude Code and choose the method that best suits you.
| Method | Suitable For | Advantages | Disadvantages |
| --- | --- | --- | --- |
| **Web Version** | Complete beginners | No installation required; just open a browser to use | Limited functionality, cannot deeply integrate with local code |
| **CLI (Command Line)** | Developers with some experience | Full-featured, high integration, closest to original design intent | Requires familiarity with command-line operations |
| **Editor Integration (VS Code / Cursor, etc.)** | Daily developers | Seamlessly integrates into existing workflows without switching windows | Depends on plugins and environment configuration |
**Recommendations:**
* If you are a **complete beginner**, visit [https://claude.ai/](https://claude.ai/) and try the web version first to get familiar with Claude's conversational style.
* If you plan to **use it for actual development**, go directly to learning the **CLI (Command Line)** β it offers the most complete features.
* Once you're comfortable with CLI, consider **editor integration** as needed.
Currently, Claude Code also provides a desktop version, which can be downloaded from the following address: [https://claude.com/download](https://claude.com/download)
!(https://static.jyshare.com/images/re/desktop-interface.avif)
This tutorial focuses primarily on the **CLI method**, as it is the most stable, universal, and closest to the original design philosophy of Claude Code.
* * *
## Install Claude Code CLI
### 1. Prerequisites
Before installation, prepare the following two items:
**β Claude Account**
* Visit [claude.ai](https://claude.ai/) to register an account
* If you're already using the Claude web chat, your account is ready β skip this step
* If you plan to use domestic models (e.g., DeepSeek, Minimax, GLM), you can temporarily skip registration; we'll explain how to switch later
**β‘ Command-Line Tool**
* **Mac / Linux:** Open the built-in Terminal
* **Windows:** Open PowerShell or install and use WSL (Windows Subsystem for Linux)
### 2. Install Using Official Script (Recommended)
An official one-click installation script is provided. Choose and run the corresponding command based on your system:
**macOS, Linux, WSL:**
curl -fsSL https://claude.ai/install.sh | bash
**Windows PowerShell:**
irm https://claude.ai/install.ps1 | iex
**Windows CMD:**
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
**Homebrew:**
brew install --cask claude-code
**WinGet:**
winget install Anthropic.ClaudeCode
**After installation, verify success with:**
claude --version
If the terminal outputs a version number (e.g., `1.x.x`), installation was successful:
2.1.81 (Claude Code)
### 3. Install via npm (Not Recommended)
The official team no longer recommends installing via npm. Use the official script above instead. If you must use npm, ensure Node.js is installed first:
node --version
If a version number (e.g., `v18.17.0`) appears, Node.js is installed. If the command is not found, download and install from [nodejs.org](https://nodejs.org/).
Once Node.js is confirmed working, install Claude Code:
npm install -g @anthropic-ai/claude-code
Wait for installation to complete (may take several minutes), then verify:
claude --version
### 4. Update Claude Code
Update directly using either command:
claude install
or:
claude update
Claude Code **automatically checks for updates** during startup and runtime. After background download completes, the update takes effect on next launch. Auto-update settings are defined in `settings.json`:
## Example
{
"autoUpdatesChannel": "stable" // Update channel: stable (recommended) or beta (preview)
}
You can also configure this inside Claude Code using the `/config` command.
To disable auto-updates, set the following in the `env` section of `settings.json`:
## Example
{
"env": {
"DISABLE_AUTOUPDATER": "1" // Set to "1" to disable auto-updates; "0" or remove line to re-enable
}
}
> Claude Code installed via **Homebrew** or **WinGet** does not support automatic updates. You must manually update using:
>
> # macOS Homebrew brew upgrade claude-code # Windows WinGet winget upgrade Anthropic.ClaudeCode
### 5. Troubleshooting Common Installation Issues
**Issue 1: `npm command not found`**
* **Cause:** Node.js is not installed
* **Solution:** Go to [nodejs.org](https://nodejs.org/) to download and install Node.js, then rerun the installation command
**Issue 2: `permission denied`**
* **Cause:** Current user lacks global installation permissions
* **Solution (Mac / Linux):** Add `sudo` before the command: sudo npm install -g @anthropic-ai/claude-code
* **Solution (Windows):** Right-click PowerShell and select "Run as administrator", then rerun the installation command
**Issue 3: Slow installation or hangs**
* **Cause:** Slow network access to overseas sources
* **Solution:** Add the `--registry` parameter to switch to a domestic mirror: npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com
**Recommended Terminals:** If your default terminal feels suboptimal, these alternatives offer better experiences with Claude Code:
* WezTerm (cross-platform): [https://wezterm.org/](https://wezterm.org/)
* Alacritty (cross-platform): [https://alacritty.org/](https://alacritty.org/)
* Ghostty (Linux / macOS): [https://ghostty.org/](https://ghostty.org/)
* Kitty (Linux / macOS): [https://github.com/kovidgoyal/kitty](https://github.com/kovidgoyal/kitty)
* * *
## Uninstall Claude Code
Choose the uninstall command based on your original installation method.
### 1. Official Script Installation (Native)
Remove the executable and version files:
**macOS, Linux, WSL:**
rm -f ~/.local/bin/claude rm -rf ~/.local/share/claude
**Windows PowerShell:**
Remove-Item -Path "$env:USERPROFILE\.local\bin\claude.exe" -ForceRemove-Item -Path "$env:USERPROFILE\.local\share\claude" -Recurse -Force
### 2. Homebrew Installation
brew uninstall --cask claude-code
### 3. WinGet Installation
winget uninstall Anthropic.ClaudeCode
### 4. npm Installation
npm uninstall -g @anthropic-ai/claude-code
### 5. Delete Configuration Files (Optional)
The above commands only remove the executable. Configuration files and history are not automatically deleted. To completely erase all data (including settings, authorized tools, MCP server configurations, and session history), run the following additional commands:
> β οΈ Deleting configuration files is **irreversible** β all local settings and history will be permanently lost. Confirm before proceeding.
**macOS, Linux, WSL:**
# Delete global user settings and state rm -rf ~/.claude rm ~/.claude.json # Delete local settings for current project (run within project directory) rm -rf .claude rm -f .mcp.json
**Windows PowerShell:**
# Delete global user settings and stateRemove-Item -Path "$env:USERPROFILE\.claude" -Recurse -ForceRemove-Item -Path "$env:USERPROFILE\.claude.json" -Force# Delete local settings for current project (run within project directory)Remove-Item -Path ".claude" -Recurse -ForceRemove-Item -Path ".mcp.json" -Force
* * *
## Log In to Claude Code
### 1. First-Time Login Process
Start Claude Code from within a project directory:
claude
On first launch, Claude Code will guide you through login. Alternatively, after entering the interface, you can manually enter the login command:
/login
Follow the prompts in the terminal to complete authorization. After login, credentials are saved locally, so **you won't need to log in again on subsequent launches**. To switch accounts, simply run `/login` again.
### 2. Supported Account Types
You may log in using any of the following account types:
#### β Claude Subscription Account (Recommended)
* **Claude Pro**: Individual professional plan
* **Claude Max**: Highest-tier subscription
* **Claude Teams**: Team plan
* **Claude Enterprise**: Enterprise plan
#### β‘ Claude Console Account (API Access)
* Access via API, billed using prepaid credits
* Ideal for developers and programmatic access scenarios
* A single email can have both subscription and Console accounts simultaneously
### 3. Automatic Workspace Creation (Console Account)
When authenticating Claude Code with a Claude Console account for the first time, a workspace named **"Claude Code"** is automatically created in your Console to:
* Track all API usage costs from Claude Code centrally
* Facilitate management of multiple users' Claude Code usage within an organization
* * *
## Start Your First Session
### 1. Launch from Project Directory
Open your terminal, navigate to your project directory, then start Claude Code. This allows it to read your project files and provide targeted assistance:
cd /path/to/your/project claude
### 2. Welcome Screen
After launch, youβll see the welcome screen showing current session info, recent conversations, and latest update notes:
!(https://example.com/wp-content/uploads/2026/01/Claude-Code-Screenshot.png)
### 3. View Available Commands
Type `/help` in the input box to see all available functions:
/help
Use `/resume` to resume a previous interrupted conversation:
/resume
Typing `/` alone triggers autocomplete with a list of all available commands:
!(https://example.com/wp-content/uploads/2026/01/d29e985e-5cb1-43bc-b6fb-e3b290f83bf9.png)
For detailed credential management information, refer to the (https://code.claude.com/docs/en/iam#credential-management) section in the official documentation.
* * *
## Ask Your First Question
### 1. Understand the Project
After launching Claude Code in your project directory, ask it to analyze your codebase:
what does this project do?
Claude will automatically read project files and provide a summary.
> **Claude Code reads files automatically as needed** β you donβt need to manually copy and paste file contents into the chat; it finds the necessary context on its own.
### 2. More Project-Related Questions
You can also ask more specific questions:
what technologies does this project use?where is
YouTip