使用中科大的源加速brew2.0.1和軟件的安裝

默認使用官網的安裝命令,會經過github下載brew、core的源碼,但家裏的電信網絡實在垃圾,根本就沒有辦法完成安裝,會卡在brew源碼的clone過程當中。git

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

中科大源提供了brew的國內鏡像,速度很是快,通過在網上查找相關的攻略,完成了brew2.0.1的安裝。github

安裝brew

經過以下命令下載brew的安裝腳本ruby

curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install

修改安裝腳本中的配置項:BREW_REPObash

#BREW_REPO = "https://github.com/Homebrew/brew".freeze #修改前的配置
BREW_REPO = "https://mirrors.ustc.edu.cn/brew.git".freeze #修改後的配置

而後執行ruby brew_install進行brew的安裝。網絡

安裝過程當中會卡在brew-core這兒app

==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...

這時用ctrl+c中斷這次安裝,並用brew --version命令驗證brew是否已經完成安裝curl

$ brew --version
Homebrew 2.0.1
Homebrew/homebrew-core (git revision 4f90; last commit 2019-02-12)

安裝brew-core

執行以下命令從中科大的源獲取core的源碼url

git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

安裝brew-cask

執行以下命令從中科大的源獲取cask的源碼code

git clone git://mirrors.ustc.edu.cn/homebrew-cask.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask --depth=1

配置bottles源

使用的bash環境,直接運行以下兩條命令便可homebrew

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

收尾

執行以下三條命令進行更新和檢測

brew update

brew doctor

brew cask doctor
相關文章
相關標籤/搜索