MAC解決homebrew網路慢
阿新 • • 發佈:2020-12-30
MAC解決homebrew網路慢
tip:親測有效
安裝brew步驟(如果已經安裝好,可跳過該步驟):
-
1.任意位置開啟終端,執行如下命令,下載brew安裝的shell指令碼
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh >> brew_install.sh
執行後生成一個brew_install.sh的shell指令碼
-
2.修改brew_install.sh指令碼
vi brew_install.sh
全域性查詢
BREW_REPO = "https://github.com/Homebrew/brew"
修改BREW_REPO的值為
BREW_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
-
3.增加可執行許可權,執行該指令碼進行安裝
chmod 777 brew_install.sh
./brew_install.sh
-
4.如果到該步卡住了:
==> Tapping homebrew/core Cloning into ‘/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core’…
-
停止安裝,進入如下資料夾:
/usr/local/Homebrew/Library/
-
刪除
Taps
資料夾 -
執行
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
-
5.安裝成功:
-
映象換源
cd $(brew --repo)
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
```
接下來執行`brew update`會發現變快了很多