OpenTokenOpenToken
首页
使用指南
官网
首页
使用指南
官网
  • OpenToken 快速开始
  • 环境准备

    • 安装 Homebrew
    • 安装 Node.js
  • Codex 指南

    • Codex Windows 使用指南
    • Codex Linux 使用指南
    • Codex Mac 使用指南
    • Codex VSCode 使用指南
    • Codex JetBrains 使用指南
  • OpenClaw

    • OpenClaw 安装配置指南
  • CC-Switch

    • CC-Switch 使用教程
    • 配置 CCSwitch(OpenToken)

安装 Homebrew

Homebrew 是 macOS 上最流行的包管理器,可以用来安装 Node.js 等开发工具。

前置准备

  • 确认系统版本:macOS Monterey (12.0) 或更高版本

  • 安装 Command Line Tools:

xcode-select --install

弹出安装窗口后点击「安装」,等待完成即可。

安装 Homebrew

方法一:国内镜像安装(推荐)

网络访问 GitHub 不稳定的用户使用此方式,速度更快:

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

方法二:官方安装脚本

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

方法三:Git 克隆安装

sudo git clone https://github.com/Homebrew/brew /opt/homebrew

验证安装

brew --version
brew doctor

brew doctor 输出 Your system is ready to brew. 说明安装正常。

配置国内镜像源(可选)

安装完成后,如果执行 brew install 速度很慢,可以切换国内镜像源。

中科大镜像

git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

清华大学镜像

git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git

常见问题

权限错误

sudo chown -R $(whoami) $(brew --prefix)/*

更新 Homebrew

brew update

恢复官方源

git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask.git
Next
安装 Node.js