Want to use Claude Code to write code but you’re stuck at the installation step? Don’t worry—this tutorial will help you resolve it quickly.
Preparation before installation
Claude Code is a command-line tool. Before installing, make sure your computer already has a Node.js environment installed. If not, just download it from the official website—the LTS version is the most stable choice.
Also, to be honest, you know what the network environment is like in China—you may need some helper tools to access it smoothly.
Install with a single command
Open the terminal and enter this command:
npm install -g @anthropic-ai/claude-code
If the download is too slow or gets stuck, try switching to a China-based mirror registry:
npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com
Mac users, remember to add sudo at the beginning, otherwise you may get an error due to insufficient permissions.
Launch and basic usage
After installation, go into your project directory:
- cd /your/project/path
- claude
The first launch requires you to log in. Just follow the prompts. After logging in successfully, you can directly use natural language to have it write code, fix bugs, and make Git commits.
Some useful shortcuts
- /clear Clear conversation history
- /cost View used quota
- /model Switch models
- Ctrl+C Abort the current operation
Honestly, once you get the hang of Claude Code, the efficiency boost is obvious—especially for repetitive tasks in day-to-day development. If you run into issues configuring the API or during the subscription process, you can check out Titikey, which has more detailed solutions and resources.