🪞 国内镜像源 / Homebrew · macOS 包管理
⭐ 觉得好用?收藏备用,下次直接打开 ✨ 开通会员去广告 · 更多权益即将开放 ☕ 支持作者

选择来源

3 个可用
bash 永久配置(写入 ~/.zshrc 或 ~/.bash_profile)
# 将下列 export 行写入当前 shell 的启动文件;已有同名变量时替换旧行,不要重复追加。
# zsh:${ZDOTDIR:-$HOME}/.zshrc
# bash:~/.bashrc;macOS 登录 bash 使用 ~/.bash_profile
# 保存后重新打开终端;在当前终端执行这些 export 行也可立即生效。
export HOMEBREW_API_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
bash 切换 brew 自身的 Git 远端
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
brew update
bash homebrew/core 源码仓库(brew 4.0 起普通用户无需配置,仅 brew 开发命令需要)
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
brew tap --force homebrew/core
brew update
bash 恢复官方源
# 先从 shell 启动文件中删除下列变量的镜像赋值(含之前添加到 ~/.bashrc 的旧配置)。
# 检查 ~/.bashrc、~/.bash_profile、${ZDOTDIR:-$HOME}/.zshrc 及自行引用的配置文件。
# 保留其他配置,保存后再执行下列命令,并重新打开终端验证。
unset HOMEBREW_API_DOMAIN HOMEBREW_BOTTLE_DOMAIN HOMEBREW_BREW_GIT_REMOTE HOMEBREW_CORE_GIT_REMOTE
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew
brew update

其他工具镜像源

已复制到剪贴板