Mac鏡像安裝Homebrew

1. 腳本說明

Homebrew默認(rèn)安裝腳本:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
如果等待一段時(shí)間之后遇到下面提示,就說明無法訪問官方腳本地址:
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation timed out
請使用下面的腳本:
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
上面腳本中使用了中科大鏡像來加速訪問。
安裝使用到的腳本源碼在此 homebrew-install ,僅修改了倉庫地址部分,不會(huì)產(chǎn)生安全隱患。

2. 安裝說明

/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"

如果命令執(zhí)行中卡在下面信息:

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

Control + C中斷腳本執(zhí)行如下命令:
cd "$(brew --repo)/Library/Taps/"
mkdir homebrew && cd homebrew
git clone git://mirrors.ustc.edu.cn/homebrew-core.git

cask 同樣也有安裝失敗或者卡住的問題,解決方法也是一樣:

cd "$(brew --repo)/Library/Taps/"
cd homebrew
git clone https://mirrors.ustc.edu.cn/homebrew-cask.git

成功執(zhí)行之后繼續(xù)執(zhí)行前文的安裝命令:

/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"

最后看到==> Installation successful!就說明安裝成功了。

最最后執(zhí)行:

brew update

3. 如何卸載Homebrew

使用官方腳本同樣會(huì)遇到uninstall地址無法訪問問題,可以替換為下面腳本:

/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/uninstall)"

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容