Claude Code Configuration Tutorial (macOS Example)
1. Preparation and Installation
1. Essential Tools
| Tool | Purpose | Download URL |
|---|---|---|
| Node.js | Runtime Environment | https://nodejs.org |
| Git | Version Control | https://git-scm.com |
2. Check Prerequisites
Verify the installations in your terminal:
node -v
git --version
3. Install Claude Code Globally
npm install -g @anthropic-ai/claude-code
4. Verify Installation
claude --version
2. Configuration and Startup
1. Configure Environment Variables
Open your terminal profile (using vim or your preferred editor like cursor):
vim ~/.zshrc
Append the following lines to the end of the file and save:
export ANTHROPIC_BASE_URL="https://******"
export ANTHROPIC_AUTH_TOKEN="******"
2. Reload Configuration
Apply the new environment variables:
source ~/.zshrc
3. Start Claude
Simply type the following in your terminal:
claude
3. Common Commands
While running Claude Code, use the following slash (/) commands for quick actions:
/help: Show all available commands/exit: Exit the current conversation/clear: Clear the current conversation history/rename <name>: Rename the current session/resume [session]: Resume a named session/model: Switch the AI model/review: Perform an AI code review/rewind: Revert changes (code/conversation)/cost: View Token usage and cost consumption
For more commands, visit the official docs: https://code.claude.com/docs/en/overview