mac homebrew修改为国内的阿里源

最近发现homebrew下载东西超级的慢,发现阿里的源很快,我这里分享一下我的修改过程:

# 替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
# 替换homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git

# 替换homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

速度超级的快,看我的日志:

(base) ➜  Documents brew update --verbose
Checking if we need to fetch /usr/local/Homebrew...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
Fetching /usr/local/Homebrew...
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
Updating /usr/local/Homebrew...
Branch 'master' set up to track remote branch 'master' from 'origin'.
Switched to and reset branch 'master'
Your branch is up to date with 'origin/master'.
Switched to and reset branch 'stable'
Current branch stable is up to date.

==> Downloading https://mirrors.aliyun.com/homebrew/homebrew-bottles/bottles-portable-ruby/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
Already downloaded: /Users/admin/Library/Caches/Homebrew/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
==> Pouring portable-ruby-2.6.3_2.yosemite.bottle.tar.gz
Already up-to-date.

参考文献

[1].解决Homebrew下载更新极慢的问题. https://www.raydbg.com/2019/Homebrew-Update-Slow/

你可能感兴趣的:(mac)