2020-04-15

最近換了Mac,安裝Homebrew很慢(以前好像并沒有這么慢),Downloading and installing Homebrew...只有10KB/S.解決方法主要思路是把git切換為清華鏡像,話不多說,直接看步驟吧.

image

1.用safari打開“https://raw.githubusercontent.com/Homebrew/install/master/install.sh”,把里面的文本復(fù)制下來,在桌面創(chuàng)建文本文件“brew_install”,粘貼.

2.搜索:

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

替換成:

BREW_REPO="https://mirrors.ustc.edu.cn/brew.git"

保存.

3.打開terminal,運(yùn)行命令:/bin/bash + 剛才的brew_install文件,比如:

/bin/bash /Users/admin/Desktop/brew_install

image

4.進(jìn)入下面的 Taps 目錄,clone homebrew-core

cd /usr/local/Homebrew/Library/Taps/homebrew (如果沒有homebrew,新建homebrew文件夾)

git clone https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

5.把homebrew repo切換為清華鏡像

cd "$(brew --repo)"

git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

brew update

PS:如果有報(bào)錯(cuò):curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused,可以通過這個(gè)命令解決:sudo gem install redis

備注:其中我在安裝的homebrew-core的時(shí)候總是不成功
參考了下邊的鏈接
https://blog.csdn.net/zhukovlxx/article/details/104729966/

使用git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
來下載homebrew-core
(轉(zhuǎn)載自小八子的開發(fā)之路,用于記錄)

?著作權(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)容