brew.git
homebrew-core.git
homebrew-bottles
$ cd "$(brew --repo)"
$ git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
还原:
$ 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://mirrors.aliyun.com/homebrew/homebrew-core.git
还原:
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
$ git remote set-url origin https://github.com/Homebrew/homebrew-core.git
$ echo $SHELL
会输出
/bin/zsh
或
/bin/bash
2、如果输出/bin/zsh,访问地址换成这个:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
$ source ~/.zshrc
还原:
$ vi ~/.zshrc
# 然后,删除 HOMEBREW_BOTTLE_DOMAIN 这一行配置
$ source ~/.zshrc
3、如果输出/bin/bash,访问地址换成这个:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile
还原:
$ vi ~/.bash_profile
# 然后,删除 HOMEBREW_BOTTLE_DOMAIN 这一行配置
$ source ~/.bash_profile
$ brew update
如果正常运行,可以不用往下看了!!
$ brew doctor
# 输出如下的错误信息
/usr/local/Homebrew/Library/Homebrew/global.rb:12:in `require': cannot load such file -- active_support/core_ext/object/blank (LoadError)
from /usr/local/Homebrew/Library/Homebrew/global.rb:12:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative'
from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `<main>'
无论报什么错误,先不管,执行以下命令
$ brew update-reset
等待更新完成之后,再次执行
$ brew update
如果正常运行,可以不用往下看了!!
Error:
homebrew-core is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
删除homebrew-core后更新即可
$ cd /usr/local/Homebrew/Library/Taps/homebrew
$ rm -rf homebrew-core
$ brew upgrade
使用$ brew upgrade后会重新更新homebrew-core
// 进入 Taps 文件夹
$ cd /usr/local/Homebrew/Library/Taps
// 新建 homebrew 文件并进入,如果有这个文件可以直接进入
$ mkdir homebrew && cd homebrew
或
$ cd homebrew
// Git 下载
$ git clone git://mirrors.ustc.edu.cn/homebrew-core.git
成功之后,执行安装命令,中途需要回车确认:
$ /bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"
最后看到==> Installation successful!就说明安装成功了。
$ brew update
基本到这就搞定了!!!配置完后再去安装下某些工具和module时就能发现畅快无比了!!