When homebrew installation, generally directly enter commands directly in the terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
But this method when network problems such as the title of this error will be reported.
This time brew_install.rb download the file directly, then the console command to run the ruby brew_install.rb. Download this file:
link: https: //pan.baidu.com/s/1rVh8bY73NLc77cQYN_2HoQ Password: n3si
————————————————
Homebrew change source
-
1. 替换brew.git:
-
$ cd "$(brew --repo)"
-
中科大:
-
$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
-
清华:
-
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
-
2. 替换homebrew-core.git:
-
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
-
中科大:
-
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
-
清华:
-
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
-
3. 替换homebrew-bottles:
-
中科大:
-
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
-
$ source ~/.bash_profile
-
清华:
-
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
-
$ source ~/.bash_profile
-
4. 应用:
-
$ brew update