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.
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.
| Form | Who it suits | How 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 / Skills | Doesn't use the system proxy. Turn on TUN or set HTTPS_PROXY |
| Web | Occasional use, without installing anything on your computer | Goes through the browser, which means the system proxy |
| IDE extension | Writing code and asking questions in VS Code or JetBrains | Follows the IDE, usually the same as the system proxy |
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.
# 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:
# 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
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
Download
Open claude.ai/download and choose your system (macOS / Windows / Linux).
Log in
Log in with your Claude account. It uses your Pro / Max quota. Connect through a residential IP for this login step.
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
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:
| Method | How to set it up | When 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 terminal | Most people. Turn it on once, and all command-line tools work |
| Set HTTPS_PROXY | See 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 |
# 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:
| Domain | What it's used for |
|---|---|
api.anthropic.com | The model requests themselves. The most important one |
claude.ai | Account login authentication. The native installer and automatic updates also use it |
claude.com | The page the browser opens during login |
platform.claude.com | Token exchange and refresh. Both login methods need it |
mcp-proxy.anthropic.com | MCP connectors brought over from claude.ai |
downloads.claude.ai | Plugin downloads, the installer, and version checks |
registry.npmjs.org | Installing plugins and running npx-based MCP servers |
statsig.com / statsigapi.net | Feature flags |
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
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.
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.
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
| Symptom | What to check first |
|---|---|
| Spins forever / times out | Is 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 open | Can 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 subscription | Is your account Pro or Max? The free plan doesn't include Claude Code. |
| Plugin / MCP installation fails | Can you reach registry.npmjs.org? |
| Connects but keeps dropping | Is 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).