Claude Code installation and network setup

Claude Code is no longer just a command-line tool. You can also use it in the desktop app, on the web, and through IDE extensions. This guide covers how to install each of the three forms, which domains to allow, why it doesn't support socks5, and the order to check things in when it won't connect.

First, make sure of one thing: Claude Code requires a paid account. The free claude.ai plan doesn't include Claude Code. You need Pro or Max (or a Team, Enterprise, or Console API account). If you don't have a subscription yet, see the full guide from signing up to using Claude.

Choose first: command line, desktop app, or web

All three forms run the same Claude Code. Your choice only affects how you interact with it and how you set up the network.

FormWho it suitsHow the network works
Desktop app (App)People who don't want to deal with the command line. It has a graphical interface and works as soon as it's installed.Usually goes through the system proxy, and it mostly works when Clash is running. But the built-in Claude Code session may not follow the system proxy, so to be safe, turn on TUN too
Command line (CLI)People who are comfortable in the terminal and want to connect MCP / SkillsDoesn't use the system proxy. Turn on TUN or set HTTPS_PROXY
WebOccasional use, without installing anything on your computerGoes through the browser, which means the system proxy
IDE extensionWriting code and asking questions in VS Code or JetBrainsFollows the IDE, usually the same as the system proxy
Most people who get stuck on network problems are command-line users. If you just want to use Claude Code and don't want to tinker with plugins, installing the desktop app is the easiest option. You won't need to touch the terminal. If it won't connect, turn on Clash's TUN (virtual network adapter) and the problem is usually solved.

Install: command-line version

The official recommendation is the native installer. It doesn't require Node.js, and it updates itself in the background after installation.

terminal
# macOS / Linux / WSL
curl -fsSL https://claude.ai/install.sh | bash

# Windows PowerShell
irm https://claude.ai/install.ps1 | iex

# After installing, start it from your project folder
claude

You can also install it with a package manager, but these methods don't update automatically. You'll need to upgrade them yourself from time to time:

terminal
# macOS Homebrew
brew install --cask claude-code

# Windows WinGet
winget install Anthropic.ClaudeCode

# npm (now requires Node 22+, not recommended)
npm install -g @anthropic-ai/claude-code
The npm install -g @anthropic-ai/claude-code command that was widely shared before now requires Node 22 or later. Older versions will fail with EBADENGINE. For a new install, use the native installer above to avoid the Node requirement altogether.

Install: desktop app

1

Download

Open claude.ai/download and choose your system (macOS / Windows / Linux).

2

Log in

Log in with your Claude account. It uses your Pro / Max quota. Connect through a residential IP for this login step.

3

Open a project

In the app, choose a local folder, and it can start reading your code and editing files.

Key point: it doesn't support socks5 proxies

Quoted directly from Anthropic's official documentation: Claude Code does not support SOCKS proxies. It only accepts HTTP proxies such as HTTPS_PROXY / HTTP_PROXY.

This trips people up often. You have a socks5 address (for example, the one your anti-detect browser uses), and you think you can enter it in the terminal too. It won't show an error, it just won't connect. The command-line version has only two ways to get online:

MethodHow to set it upWhen to use it
Turn on TUN (recommended)In Clash / Stash, turn on the TUN (virtual network adapter) switch. You don't need to configure anything in the terminalMost people. Turn it on once, and all command-line tools work
Set HTTPS_PROXYSee the commands below. Use your client's HTTP proxy port (not the socks port)When you can't turn on TUN, or you only want one terminal to use the proxy
terminal
# macOS / Linux: use the client's HTTP port, usually 7890
export HTTPS_PROXY=http://127.0.0.1:7890
export HTTP_PROXY=http://127.0.0.1:7890
claude

# Windows PowerShell
$env:HTTPS_PROXY="http://127.0.0.1:7890"
claude

Note that export only applies to the current terminal window, and it's gone when you close it. To make it permanent, add it to ~/.zshrc or ~/.bashrc.

Which domains to allow

If you use our subscription configuration, the domains below are already built in and routed through the residential IP. You don't need to do anything. If you write your own rules, or your company network has an allowlist, allow the domains in this list:

DomainWhat it's used for
api.anthropic.comThe model requests themselves. The most important one
claude.aiAccount login authentication. The native installer and automatic updates also use it
claude.comThe page the browser opens during login
platform.claude.comToken exchange and refresh. Both login methods need it
mcp-proxy.anthropic.comMCP connectors brought over from claude.ai
downloads.claude.aiPlugin downloads, the installer, and version checks
registry.npmjs.orgInstalling plugins and running npx-based MCP servers
statsig.com / statsigapi.netFeature flags
If you write suffix-based rules, the three rules anthropic.com, claude.ai, and claude.com cover the first six entries above. Login and model requests must go through the residential IP, because they carry your account identity.

Self-check these three items after installing

1

Was it installed?

Run claude --version in the terminal. It should print a version number. If you get command not found, it wasn't installed or isn't on your PATH.

2

Is the setup correct?

Run claude doctor. It reads the installation status, configuration file syntax, and update status without making changes, and it gives repair suggestions. It won't start a session, so it's safe to run.

3

Is the proxy working?

Once you're in a session, type /status and check the Proxy line. Does it show the address you set? If the value is wrong (for example, if you left out http://), it will be marked as invalid.

If it won't connect, check in this order

SymptomWhat to check first
Spins forever / times outIs TUN on? Or is HTTPS_PROXY set to the HTTP port? (If you set it to the socks port, it will never connect.)
Login redirect won't openCan your browser open claude.ai? Login goes through the browser, so if the browser can't connect, the command line can't either.
Says no permission / asks for a subscriptionIs your account Pro or Max? The free plan doesn't include Claude Code.
Plugin / MCP installation failsCan you reach registry.npmjs.org?
Connects but keeps droppingIs the node stable? Long cross-border connections often get cut by intermediate devices. Try a different route, or ask in our QQ group.

Bonus: make it more than a chatbot

Once it's installed, adding MCP and Skills is what makes it truly useful. You can hand it tasks like looking up the latest documentation, running a browser, and producing documents that follow a standard. See Recommended MCP and Skills: full setup and usage guide (in Chinese).

If you want to switch to a domestic model or a third-party relay to save money, see Switching to other vendors' models with cc-switch (in Chinese).