homebrew安装时,一般直接在终端直接输入命令:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
但是这个方法在网络有问题时会报如题这个错误。
这个时候直接将文件brew_install.rb下载,然后控制台运行ruby brew_install.rb命令即可。此文件下载地址:
链接:https://pan.baidu.com/s/1rVh8bY73NLc77cQYN_2HoQ 密码:n3si
————————————————
Homebrew换源
-
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