使用Homebrew安装automake,提示Updating Homebrew…之后长时间等待,可以使用如下方法予以应对。
方式1: Control + C取消更新
liumiaocn:tmux liumiao$ brew install automake
Updating Homebrew...
^C
==> Installing dependencies for automake: autoconf
==> Installing automake dependency: autoconf
==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.high_sierra.bottle.4.tar.gz
...省略
==> Caveats
==> autoconf
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/autoconf
liumiaocn:tmux liumiao$
方式2: 临时禁用Homebrew更新
卡住的地方在于更新,方式一中断的是更新,中断之后安装继续,所以能够成功。与之类似的方式就是临时禁用Homebrew更新,可以通过环境变量来设定HOMEBREW_NO_AUTO_UPDATE来达到同样目的,这里由于之前已经设定成功,所以显示已经安装完成。
liumiaocn:tmux liumiao$ export HOMEBREW_NO_AUTO_UPDATE=true
liumiaocn:tmux liumiao$ brew install automake
Warning: automake 1.16.1 is already installed and up-to-date
To reinstall 1.16.1, run `brew reinstall automake`
liumiaocn:tmux liumiao$
方式3: 换源
无论是方式1还是方式2,都是不进行更新的方式,换成可用的源即可解决问题,通过目前确认的结果,清华的源仍然可用。需要换的git的源的信息主要如下:
repo | 中科大源 | 清华源 |
---|---|---|
brew.git | https://mirrors.ustc.edu.cn/brew.git | https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git |
homebrew-core.git | https://mirrors.ustc.edu.cn/homebrew-core.git | https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git |
homebrew-bottles | export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles | export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles |
- 步骤1: 设定brew.git
liumiaocn:~ liumiao$ cd /usr/local/Homebrew/
liumiaocn:Homebrew liumiao$ git remote -v
origin https://github.com/Homebrew/brew (fetch)
origin https://github.com/Homebrew/brew (push)
]liumiaocn:Homebrew liumiao$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
liumiaocn:Homebrew liumiao$ git remote -v
origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git (fetch)
origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git (push)
liumiaocn:Homebrew liumiao$
- 步骤2: 设定homebrew-core.git
liumiaocn:Homebrew liumiao$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
liumiaocn:homebrew-core liumiao$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
liumiaocn:homebrew-core liumiao$ git remote -v
origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git (fetch)
origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git (push)
liumiaocn:homebrew-core liumiao$
这两步设定完毕之后即可执行brew update了
- 步骤3: 执行brew update
liumiaocn:homebrew-core liumiao$ brew update
==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring portable-ruby-2.6.3.mavericks.bottle.tar.gz
Updated 2 taps (homebrew/core and homebrew/services).
==> New Formulae
...省略
==> Deleted Formulae
...省略
liumiaocn:homebrew-core liumiao$
- 复原方法
如需复原则使用相同的上述步骤,只需要替换对应的链接地址即可,具体命令如下所示:
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