Claude Code Mac
Claude Code Mac 使用教程。
当前建议分组:
AppClaude当前建议模型:claude-opus-4-6
(一) 安装 Node.js 环境
方法一:Homebrew
1brew install node
方法二:官网下载
- 打开
https://nodejs.org/ - 下载
LTS安装包 - 按默认选项安装
验证安装:
1node --version
2npm --version
(二) 安装 Claude Code
1npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com
验证安装:
1claude --version
(三) 配置 Claude Code
方法一:写入 ~/.zshrc
1echo 'export ANTHROPIC_BASE_URL="https://4router.net"' >> ~/.zshrc
2echo 'export ANTHROPIC_AUTH_TOKEN="sk-REPLACE_ME"' >> ~/.zshrc
3source ~/.zshrc
方法二:编辑 ~/.claude/settings.json
1{
2 "env": {
3 "ANTHROPIC_BASE_URL": "https://4router.net",
4 "ANTHROPIC_AUTH_TOKEN": "sk-REPLACE_ME",
5 "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
6 }
7}
(四) 开始使用 Claude Code
1claude
第一次建议只做一个最小测试:
1如果你已经接到 4Router,请只回复:AppClaude 已连接
(五) 常见问题
claude命令找不到:检查 Homebrew 或 npm 的全局 bin 目录是否在PATH中。- 配置没有生效:重新打开 Terminal 或执行
source ~/.zshrc。 - 鉴权失败:确认
ANTHROPIC_AUTH_TOKEN中填写的是你的 4Router Key。 - Claude 模型请求失败:先去控制台确认当前令牌能否使用
AppClaude分组。