更新命令
1
brew update
替换源
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 中科院
SOURCE_URL=https://mirrors.ustc.edu.cn
# 替换brew.git:
cd "$(brew --repo)"
git remote set-url origin $SOURCE_URL/brew.git
# 替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin $SOURCE_URL/homebrew-core.git
# 替换homebrew-cask.git:
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin $SOURCE_URL/homebrew-cask.git
# 修改环境变量
# echo "export HOMEBREW_BOTTLE_DOMAIN=$SOURCE_URL/homebrew-bottles" >> ~/.bash_profile
# source ~/.bash_profile
# 更新
还原
1
2
3
4
5
6
7
8
SOURCE_URL=https://github.com/Homebrew
cd "$(brew --repo)"
git remote set-url origin $SOURCE_URL/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin $SOURCE_URL/homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask"
git remote set-url origin $SOURCE_URL/homebrew-cask.git
# 更新
源地址
1
2
3
4
5
6
7
# 清华大学
https://mirrors.tuna.tsinghua.edu.cn/git/homebrew
# 中科大
https://mirrors.ustc.edu.cn
# 阿里
# ...