🪞 国内镜像源 / Homebrew · macOS 包管理 # 将下列 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
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
brew tap --force homebrew/core
brew update
# 先从 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
# 将下列 export 行写入当前 shell 的启动文件;已有同名变量时替换旧行,不要重复追加。
# zsh:${ZDOTDIR:-$HOME}/.zshrc
# bash:~/.bashrc;macOS 登录 bash 使用 ~/.bash_profile
# 保存后重新打开终端;在当前终端执行这些 export 行也可立即生效。
export HOMEBREW_API_DOMAIN="https://mirrors.aliyun.com/homebrew/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.aliyun.com/homebrew/homebrew-bottles"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/brew.git"
bash 切换 brew 自身的 Git 远端
git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
brew update
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.aliyun.com/homebrew/homebrew-core.git"
brew tap --force homebrew/core
brew update
# 先从 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
# 将下列 export 行写入当前 shell 的启动文件;已有同名变量时替换旧行,不要重复追加。
# zsh:${ZDOTDIR:-$HOME}/.zshrc
# bash:~/.bashrc;macOS 登录 bash 使用 ~/.bash_profile
# 保存后重新打开终端;在当前终端执行这些 export 行也可立即生效。
export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
bash 切换 brew 自身的 Git 远端
git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
brew update
# 先从 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
已复制到剪贴板
当前在 App 内置浏览器中,文件可能无法下载保存。请点右上角菜单,选择「在浏览器中打开」。