homebrew安裝
ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
解決brew安裝速度慢的問題
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.恢複brew配置
- 重置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
在這裡插入代碼片`注釋掉之前加入的語句就行
解決brew安裝包一直卡在Updating Homebrew
運作指令brew install node,結果界面一直卡在Updating Homebrew上,有兩種解決辦法
方法一:直接關閉brew每次執行指令時的自動更新(推薦)
vim ~/.bash_profile
# 新增一行
export HOMEBREW_NO_AUTO_UPDATE=true
方法二:
出現Updating Homebrew的時候ctrl+c一下