Titikey
HomeTips & TricksClaudeClaude Code User Guide: Install and Get Started on Windows/macOS in One Article

Claude Code User Guide: Install and Get Started on Windows/macOS in One Article

2/4/2026
Claude

This Claude tutorial focuses specifically on Claude Code: from installation and verification to binding an API Key, and then troubleshooting common errors. Follow the steps and you can get Claude Code running in your terminal within 10 minutes, using it for code generation, bug fixing, and simple development collaboration.

1. Pre-installation prep: Don’t get tripped up by the Node.js version

Claude Code depends on a Node.js environment. It’s recommended to install Node.js 18 or above first, then open a new terminal window. Windows users can just run the installer and keep clicking Next; on macOS, you can install via the official installer package or a package manager. After installation, type node -v in the terminal to confirm the version is correct.

2. Install Claude Code: Global npm install and China mirror

Run the global installation command in the terminal: npm install -g @anthropic-ai/claude-code. This is the most common way to install Claude Code. If your network is slow when accessing the official npm registry, you can switch to a mirror: npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com. After installation, reopen the terminal and enter claude --version to verify that Claude Code is available.

3. First run and binding the API Key: Make Claude Code actually usable

Claude Code requires authorization via an Anthropic API Key. When you run claude for the first time, it will usually guide you to configure the key. A more reliable approach is to set the environment variable ANTHROPIC_API_KEY in your system first, then start Claude Code, so you don’t have to re-enter it each time. After that, open a terminal in your project directory and describe tasks in natural language—for example, ask Claude Code to analyze an error, generate a fix patch, and tell you how to verify it.

4. Common Claude Code issues: How to handle freezing, errors, and interruptions

If Claude Code requests fail or it gets interrupted frequently, first check network stability and whether you’ve hit server-side rate limits; switching to a more stable network often helps significantly. If you encounter installation errors, most are due to an outdated Node.js version or global permission issues—upgrading Node.js and reinstalling with administrator/sudo privileges usually resolves them. If claude --version produces no output, confirm that the global npm path has been added to PATH, and then run Claude Code again in a new terminal.

HomeShopOrders