Homebrew 更换国内镜像源

更换仓库源

1
2
3
4
5
6
7
8
9
10
cd $(brew --repo)
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.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

cd $(brew --repo)/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

brew update

更换 Homebrew-bottles 镜像(影响软件下载速度)

1
2
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zprofile
source ~/.zprofile

备注

Homebrew 原始源

1
2
3
https://github.com/Homebrew/brew.git
https://github.com/Homebrew/homebrew-core.git
https://github.com/Homebrew/homebrew-cask.git

Homebrew 国内源

清华

1
2
3
4
5
https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git

https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles

USTC

1
2
3
4
5
https://mirrors.ustc.edu.cn/brew.git
https://mirrors.ustc.edu.cn/homebrew-core.git
https://mirrors.ustc.edu.cn/homebrew-cask.git

https://mirrors.ustc.edu.cn/homebrew-bottles

腾讯云

1
2
3
4
5
https://mirrors.cloud.tencent.com/homebrew/brew.git
https://mirrors.cloud.tencent.com/homebrew/homebrew-core.git
https://mirrors.cloud.tencent.com/homebrew/homebrew-cask.git

https://mirrors.cloud.tencent.com/homebrew-bottles

阿里云

1
2
3
4
https://mirrors.aliyun.com/homebrew/brew.git
https://mirrors.aliyun.com/homebrew/homebrew-core.git

https://mirrors.aliyun.com/homebrew/homebrew-bottles