國內安裝homebrew總結


用到的鏡像:
https://gitee.com/mirrors/homebrew.git
https://gitee.com/jinxin.70/homebrew-core.git
https://gitee.com/jinxin.70/homebrew-cask.git

1、安裝前准備:

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
echo 'export HOMEBREW_CORE_GIT_REMOTE=https://mirrors.aliyun.com/homebrew/homebrew-core.git' >> ~/.bash_profile
source ~/.bash_profile

2、下載國內的安裝腳本:

git clone https://gitee.com/jinxin.70/install.git
cd install

我已經將腳本install.sh中的BREW_REPO變量改過了,有興趣你可以打開腳本看看

BREW_REPO="https://github.com/Homebrew/brew"

改成了

BREW_REPO="https://gitee.com/mirrors/homebrew.git"

3、接着,運行 install.sh 以安裝 Homebrew:

此時,你可能會卡在

==> Tapping homebrew/core

Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'

ctrl+c停下,繼續下一步

4、手動克隆core和cask

cd /usr/local/Homebrew/Library/Taps/homebrew
git clone https://gitee.com/jinxin.70/homebrew-core.git
git clone https://gitee.com/jinxin.70/homebrew-cask.git

5、然后繼續運行安裝腳本install.sh

bash ~/install/install.sh

6、安裝好后,替換核心包倉庫的配置為阿里雲鏡像

# 替換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

參考:
https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/
https://developer.aliyun.com/mirror/homebrew
https://juejin.cn/post/6844903782589923335


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM