一般遇到這種問題,就跟墻有關啦,需要更換源 或者設置代理。
一.設置代理(百度未嘗試)
brew用curl下載,所以給curl掛上socks5的代理即可。
在~/.curlrc文件中輸入代理地址即可。
二.更換源(題主使用)
用清華的源就非常好,去清華鏡像的官網看一下說明,
https://mirrors.tuna.tsinghua.edu.cn/help/homebrew/
$ cd /usr/local/Homebrew
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
$ cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
$ brew update
還原:
$ cd "$(brew --repo)"
$ git remote set-url origin https://github.com/Homebrew/brew.git
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
$ git remote set-url origin https://github.com/Homebrew/homebrew-core
$ brew update
"$(brew --repo)" 這里填/usr/local/Homebrew
如果有問題,請聯系作者進行處理