起因是用 homebrew 官方源安裝 imagemagick 提示 mismatch sha256sum,然后就進入漫長的下載源碼包編譯的過程,大概半個小時過去了仍然沒有裝好。
第二天,便想起阿里雲、騰訊雲都有 homebrew 的國內鏡像源,再加上中科大的鏡像源,都嘗試了遍。
阿里雲 homebrew
配置方法:[https://developer.aliyun.com/mirror/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
# 應用生效
brew update
# 替換homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
騰訊雲 homebrew
配置方法:Homebrew 鏡像使用幫助 [https://mirrors.cloud.tencent.com/help/homebrew.html]。
cd "$(brew --repo)"
git remote set-url origin http://mirrors.cloud.tencent.com/git/homebrew/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin http://mirrors.cloud.tencent.com/git/homebrew/homebrew-core.git
brew update
配置方法:Homebrew-bottles 鏡像使用幫助 [https://mirrors.cloud.tencent.com/help/homebrew-bottles.html]。
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.cloud.tencent.com/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
中科大 homebrew
配置方法:Homebrew 源使用幫助[http://mirrors.ustc.edu.cn/help/brew.git.html]。
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
配置方法:Homebrew Core 源使用幫助[http://mirrors.ustc.edu.cn/help/homebrew-core.git.html]。
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
配置方法:Homebrew Bottles 源使用幫助[http://mirrors.ustc.edu.cn/help/homebrew-bottles.html]。
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
使用比較
使用阿里雲或者騰訊雲的 homebrew 鏡像源安裝 imagemagick,有的包下載提示404了。中科大源沒有報錯,就是下載速度比較慢,大概100多k每秒的速度。
最終選擇中科大[USTC] homebrew 鏡像源。