前言
在電腦上通過Homebrew安裝MongoDB時卡在(updating homebrew…)不動
解決方法
1、使用移動4g熱點,(速度明顯上升)
2、切換使用brew中科大源
在終端依次執行
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
cd
brew update
完成後重新執行brew install xxx
如果還是不行,替換Homebrew Bottles源
Homebrew是OS X系統的一款開源的包管理器。出於節省時間的考慮,Homebrew默認從Homebrew Bottles源中下載二進制代碼包安裝。Homebrew Bottles是Homebrew提供的二進制代碼包,
目前鏡像站收錄了以下倉庫:
homebrew/homebrew-core
homebrew/homebrew-dupes
homebrew/homebrew-games
homebrew/homebrew-gui
homebrew/homebrew-python
homebrew/homebrew-php
homebrew/homebrew-science
homebrew/homebrew-versions
homebrew/homebrew-x11
在終端執行
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
恢復,切換回官方源
第一步:重置brew.git
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git
第二步:重置homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git
cd
brew update
第三步:註釋掉bash配置文件裏的有關Homebrew Bottles即可恢復官方源。 重啓bash或讓bash重讀配置文件。