Homebrew切换镜像源(中科大&清华镜像)

零、Homebrew 镜像地址(推荐中科大镜像)

1、brew.git 镜像

中科大镜像:https://mirrors.ustc.edu.cn/brew.git

清华镜像:https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

GitHub镜像:https://github.com/Homebrew/brew.git

2、homebrew-core.git 镜像

中科大镜像:https://mirrors.ustc.edu.cn/homebrew-core.git

清华镜像:https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

GitHub镜像:https://github.com/Homebrew/homebrew-core

一、替换 Homebrew 镜像源

1、替换 brew.git

以中科大镜像为例

$ cd "$(brew --repo)"

$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

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

2、替换 homebrew-core.git

以中科大镜像为例

$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

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

二、重置 Homebrew 镜像源

切回官方原始镜像(GitHub)

$ 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

三、参考资料

1、Updating Homebrew... 长时间不动解决方法

2、清华大学开源镜像 | Homebrew 镜像使用帮助