您当前的位置: 首页 >  杨林伟

Mac解决Updating Homebrew卡顿

杨林伟 发布时间:2022-02-08 23:45:02 ,浏览量:2

文章目录

  • 01 引言
  • 02 关闭提示
  • 03 替换镜像源
    • 3.1 替换为ustc源
    • 3.2 替换为coding源
    • 3.3 替换为tsinghua源
  • 04 恢复设置

01 引言

我们如果使用brew命令安装一些插件是,会卡在Updating Homebrew

那么该如何解决呢?有两种方式:

  1. 关闭提示(治标不治本)
  2. 替换镜像源

02 关闭提示

首先看看关闭提示的方式,直接在控制台输入命令:

vim ~/.bash_profile

并在最后一行增加:

export HOMEBREW_NO_AUTO_UPDATE=true

最后使配置生效:

source ~/.bash_profile

03 替换镜像源

3.1 替换为ustc源

cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
brew update
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
brew update

我的本机操作成功了,如下图:

3.2 替换为coding源

cd "$(brew --repo)"
git remote set-url origin https://git.coding.net/homebrew/homebrew.git
brew update

3.3 替换为tsinghua源

cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew-core.git
brew update

04 恢复设置

如果以上设置都不行,则恢复默认设置:

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.git
关注
打赏
查看更多评论

杨林伟

暂无认证

  • 2浏览

    0关注

    3183博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录