最近換了Mac,安裝Homebrew很慢(以前好像并沒有這么慢),Downloading and installing Homebrew...只有10KB/S.解決方法主要思路是把git切換為清華鏡像,話不多說,直接看步驟吧.
image
1.用safari打開“https://raw.githubusercontent.com/Homebrew/install/master/install.sh”,把里面的文本復制下來,在桌面創建文本文件“brew_install”,粘貼.
2.搜索:
BREW_REPO="https://github.com/Homebrew/brew"
替換成:
BREW_REPO="https://mirrors.ustc.edu.cn/brew.git"
保存.
3.打開terminal,運行命令:/bin/bash + 剛才的brew_install文件,比如:
/bin/bash /Users/admin/Desktop/brew_install
image
4.進入下面的 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:如果有報錯:curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused,可以通過這個命令解決:sudo gem install redis
備注:其中我在安裝的homebrew-core的時候總是不成功
參考了下邊的鏈接
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
(轉載自小八子的開發之路,用于記錄)