brew update 卡住,更新 homebrew 官方源为中科大源(推荐)

  近日在自己电脑上brew install xxxx 的时候,发现自动更新homebrew时,卡住很长时间都没有进行下去 。

  通过 brew update --verbose , 发现卡在了homebrew-cask 更新上。在这之前将homebrew源由github 更新成了阿里云镜像的源,经过确认才发现,阿里云镜像站中只有brew-core 没有brew-cask 。 而此时,将homebrew-cask 的源替换成中科大的也没用。同样会卡住。索性全部替换成中科大的源:

// 替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

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

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

再次brew update ,顺利更新成功。

halberd:homebrew-cask halberd$ brew update --verbose
Checking if we need to fetch /usr/local/Homebrew...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask...
Fetching /usr/local/Homebrew...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask...
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
remote: Counting objects: 2032, done.
remote: Compressing objects: 100% (542/542), done.
remote: Total 2032 (delta 1510), reused 2008 (delta 1490)
Receiving objects: 100% (2032/2032), 779.51 KiB | 322.00 KiB/s, done.
Resolving deltas: 100% (1510/1510), completed with 464 local objects.
From https://mirrors.ustc.edu.cn/homebrew-core
   3ec0e6d65d..7f57a7247b  master     -> origin/master
remote: Counting objects: 38587, done.
remote: Compressing objects: 100% (15839/15839), done.
remote: Total 38587 (delta 28331), reused 32948 (delta 22748)
Receiving objects: 100% (38587/38587), 30.13 MiB | 1.68 MiB/s, done.
Resolving deltas: 100% (28331/28331), completed with 1706 local objects.
From https://mirrors.ustc.edu.cn/homebrew-cask
   da61b406f4..edb591d620  master     -> origin/master
remote: Counting objects: 413, done.
remote: Compressing objects: 100% (157/157), done.
remote: Total 413 (delta 315), reused 333 (delta 238)
Receiving objects: 100% (413/413), 54.07 KiB | 1.10 MiB/s, done.
Resolving deltas: 100% (315/315), completed with 158 local objects.

...........

Updating /usr/local/Homebrew...

............

Updating /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask...

..........
==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics have been recorded yet (or will be during this `brew` run).

git config --replace-all homebrew.analyticsmessage true
git config --replace-all homebrew.caskanalyticsmessage true
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
...........

内容实在太长,略掉吧

  

原文地址:https://www.cnblogs.com/halberd-lee/p/12500338.html