更新 Homebrew 源为官方的 GitHub 仓库
在 macOS 上更换 Homebrew 官方源可以通过以下步骤完成:
#重置brew.git
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
#重置homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
# 重置homebrew-cask.git
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://github.com/Homebrew/homebrew-cask.git
# 应用生效
brew update
这将更新 Homebrew 源为官方的 GitHub 仓库。
更新 Homebrew 源为你选择的国内源
在 macOS 上更换 Homebrew 的国内源可以通过以下步骤完成:
#重置brew.git
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
#重置homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 重置homebrew-cask.git
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
# 应用生效
brew update
1、清华大学源
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
2、中科大源
https://mirrors.ustc.edu.cn/brew.git
https://mirrors.ustc.edu.cn/homebrew-core.git
https://mirrors.ustc.edu.cn/homebrew-cask.git
3、阿里云源
https://mirrors.aliyun.com/homebrew/brew.git
https://mirrors.aliyun.com/homebrew/homebrew-core.git
请注意,更换 Homebrew 源可能会导致一些问题,例如速度变慢或者某些软件包不可用。如果遇到任何问题,你可以通过恢复备份的命令来还原到原始的 Homebrew 源。
发布时间 : 2023-02-28,阅读量:1753