美文网首页
卡在 Updating Homebrew…

卡在 Updating Homebrew…

作者: 越前君 | 来源:发表于2020-08-16 13:09 被阅读0次

一、安装 Homebrew

看之前写的一篇【Homebrew 使用详解,macOS 的第二个 Mac App Store】文章,不再赘述了。

二、每次安装包卡在 Updating Homebrew 的问题

原因是 Homebrew 每次安装包的时候默认开启了自动更新的设置。可通过配置关闭掉。

# 在 .bash_profile 或者 .zshrc 添加一行配置(具体看自己终端默认 Shell 是 bash 还是 zsh)
# 1. 打开 (二选一)
$ vim ~/.bash_profile 
$ vim ~/.zshrc

# 2. 在对应文件,添加一行配置,并保存
export HOMEBREW_NO_AUTO_UPDATE=true

# 3. 刷新配置(二选一)
$ source ~/.bash_profile
$ source ~/.zshrc

还有一个比较狗血的方法就是:ctrl + c 跳过。但还是修改配置的方式一劳永逸。

三、brew install package 慢的问题

具体思路是替换 Homebrew 镜像源。

  1. 替换 brew.git
$ cd "$(brew --repo)"
$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
  1. 替换 homebrew-core.git
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
  1. 重置 brew.git
$ cd "$(brew --repo)"
$ git remote set-url origin https://github.com/Homebrew/brew.git
  1. 重置 homebrew-core.git
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
$ git remote set-url origin https://github.com/Homebrew/homebrew-core.git

好吧,替换之后,我还是觉得慢。

相关文章

网友评论

      本文标题:卡在 Updating Homebrew…

      本文链接:https://www.haomeiwen.com/subject/wbcodktx.html