mac 下 homebrew 安裝很慢的解決方案

一、mac 自帶的 ruby 安裝 homebrew

一般咱們百度之後會用mac自帶的ruby去安裝homebrew,以下:git

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

而後發現downloading很慢基本就10kb/sgithub

二、親測有用的解決方案

1. 先獲取install文件,好比命名爲brew_install:

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

2. 打開brew_install文件進行修改:

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

改成中國科大的源:ruby

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

3. 保存之後ruby執行brew_install

ruby brew_install

此時腳本會停在 :app

==> Tapping homebrew/core Cloning into ‘/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core’…

4. 把homebrew-core更換爲中國科大鏡像

git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
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

5. 安裝成功、更新、檢測

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