Claude Code
As a product of Anthropic
The company launched a command line AI programming aid that can interact with project code directly in a terminal environment to help developers accomplish tasks such as code generation, logic interpretation and error troubleshooting. In 1.0.51
After the version update, theClaude Code
finally Windows
platform brings native support, which means Windows
Users no longer need to go through the WSL
(Windows Subsystem for Linux) for tedious configuration, thus avoiding potential performance overhead and file system compatibility issues.
Environmental requirements
Before installing, make sure the system meets the following conditions:
- operating system
- Windows. Windows 10 or later
- macOS. macOS 10.15 or later
- Linux. Ubuntu 20.04+ / Debian 10+ or compatible distributions
- Common tools
- Node.js. 18+ version (download address)
- Git. Version 2.23+ (download address)
Installation and Configuration
Installation varies slightly from platform to platform, so here are the steps.
Mac and Linux
exist macOS
maybe Linux
On the system, open a terminal and execute the following global install command:
npm install -g @anthropic-ai/claude-code
Once the installation is complete, you need to configure environment variables for authorization. Edit the user directory of the .zshrc
(Zsh) or .bashrc
(Bash) configuration file, add the following:
export ANTHROPIC_API_KEY="sk-..."
export ANTHROPIC_BASE_URL="https://api.anthropic.com"
draw attention to sth.: In macOS
You can use the shortcut Command+Shift+.
to show the hidden files, then use a text editor to open the .zshrc
Documentation.
After adding the configuration, execute the source ~/.zshrc
command to make the changes take effect immediately.
Windows Native Configuration
Windows
Platform's native support dependencies Git for Windows
The Unix command-line toolset provided.
- Installing Git for Windows
please go to gitforwindows.org Download and install the latest version. The installer will automatically configure thegrep
,curl
,ssh
and other necessary orders. - Setting Enforcement Policies
Open in administrator modePowerShell
, run the following command to allownpm
Execute the installation script:Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
- Global Installation Claude Code
existPowerShell
Execute the following command to install it:npm install -g @anthropic-ai/claude-code@latest
If you encounter errors related to script execution during installation, try using the
--ignore-scripts
parameter to resolve:npm install -g @anthropic-ai/claude-code --ignore-scripts
- Configuring Environment Variables
show (a ticket)PowerShell
and execute the following command to set the environment variable, please set thesk-...
Replace yourAPI
Key.[System.Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "sk-...", "User") [System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.anthropic.com", "User")
After the configuration is complete, you need to reboot the
PowerShell
Terminal to enable environment variables.
First time startup and use
After completing the installation and configuration, you can start using it.
- starter kit
In the terminal, go to your project folder and execute theclaude
Command.cd ~/Desktop/my-project claude
- Verify Configuration
You can always runclaude doctor
command to check theClaude Code
configuration is correct, it will list the currently detectedAPI
keys andBase URL
The - Account Authorization
At first startup, if you do not use the customAPI
key, the tool may open an authorization page in your browser, requiring you to log in to theClaude
Official website for confirmation.When the tool detects that you have configured custom
API
When the key is used, you will be prompted whether to use the key or not, select "Yes" to do so.If you are using a third-party proxy service and wish to skip the official login authentication process, you can add a new proxy to your user home directory in the
.claude.json
The following is added to the file:{ "hasCompletedOnboarding": true }