homebrew安裝和解決brew安裝速度慢的問題


homebrew安裝

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

解決brew安裝速度慢的問題(替換homebrew鏡像源)

1.替換brew.git:

cd "$(brew --repo)”
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git

2.替換homebrew-core.git:

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git

3.終端輸入命令:

echo $SHELL 看輸出結果是/bin/zsh還是/bin/bash

  • /bin/zsh替換homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
  • /bin/bash替換homebrew-bottles:
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

4.恢復homebrew國內鏡像源配置

  • 重置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
  • 重置homebrew-bottles
將剛添加到~/.bash_profile文件的語句注釋掉即可

解決brew安裝包一直卡在Updating Homebrew

運行命令brew install node,結果界面一直卡在Updating Homebrew上,有兩種解決辦法

方法一:關閉brew每次執行命令時的自動更新(推薦)

vim ~/.bash_profile
# 新增一行
export HOMEBREW_NO_AUTO_UPDATE=true

方法二(懶人方法):

出現Updating Homebrew的時候ctrl+c一下就行


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM