macOS 安装 Claude Code
前置要求
- macOS 12 或更高版本
- Node.js 18+
# 使用 Homebrew 安装 Node.js
brew install node
安装步骤
1. 安装 Claude Code
npm install -g @anthropic-ai/claude-code
2. 配置 QClaw Router
# 添加到 ~/.zshrc(默认 Shell)
echo 'export ANTHROPIC_BASE_URL="https://api.qclawrouter.com"' >> ~/.zshrc
echo 'export ANTHROPIC_API_KEY="sk-your-api-key"' >> ~/.zshrc
source ~/.zshrc
3. 启动
如果使用 bash 而非 zsh,将上述 ~/.zshrc 替换为 ~/.bashrc。
验证配置
# 检查环境变量是否生效
echo $ANTHROPIC_BASE_URL
# 应输出: https://api.qclawrouter.com