背景
mac book 升級(jí)操作系統(tǒng)以后,brew變得缺胳膊少腿毅否,不能正常運(yùn)行了
搜了很多修復(fù)的辦法都不能工作。
初次嘗試
后面去brew官網(wǎng)https://brew.sh/找到這個(gè)命令
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
但是因?yàn)橛心且欢聜ゴ蟮膲Φ锱兀芏噘Y源拉不下來(lái)洲敢。
開(kāi)動(dòng)腦筋
機(jī)制的我想,國(guó)內(nèi)肯定有人碰到類似的問(wèn)題劈愚,然后已經(jīng)有墻內(nèi)辦法了瞳遍,于是在gitee上搜索試試運(yùn)氣,運(yùn)氣不錯(cuò)菌羽,找到這個(gè)項(xiàng)目
https://gitee.com/cunkai/HomebrewCN
里面的下面這條命令幫我解決了問(wèn)題
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
小試牛刀
$ brew install watchman
....此處省略日志若干行
$ which watchman
/usr/local/bin/watchman
完美解決掠械,一勞永逸
為了一勞永逸解決問(wèn)題,把brew源切換為國(guó)內(nèi)源吧注祖,我是切換到清華大學(xué)的倉(cāng)庫(kù)猾蒂,操作如下
# 替換各個(gè)源
$ git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
$ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
$ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
# zsh 替換 brew bintray 鏡像
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
$ source ~/.zshrc
# bash 替換 brew bintray 鏡像
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile
# 刷新源
$ brew update