why Updating homebrew takes forever?

Viewed 19709

this is my brew config

HOMEBREW_VERSION: 3.0.10-23-g5e0b08d
ORIGIN: https://github.com/Homebrew/homebrew-core
HEAD: 5e0b08dd01bdce3523c7e095739641b6f33b902a
Last commit: 6 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 5e0b08dd01bdce3523c7e095739641b6f33b902a
Core tap last commit: 6 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 4
Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3_2/bin/ruby
CPU: quad-core 64-bit icelake
Clang: 12.0 build 1200
Git: 2.24.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 10.15.7-x86_64
CLT: 12.4.0.0.1.1610135815
Xcode: N/A

when I try to download something via brewing (for instance CAT) terminal says "Updating Homebrew" and it takes forever

and brew doctor says

 "Warning: Suspicious https://github.com/Homebrew/brew git origin remote found.
The current git origin is:
  https://github.com/Homebrew/homebrew-core

With a non-standard origin, Homebrew won't update properly.
You can solve this by setting the origin remote:
  git -C "/usr/local/Homebrew" remote set-url origin https://github.com/Homebrew/brew"

so I typed

git -C "/usr/local/Homebrew" remote set-url origin https://github.com/Homebrew/brew
 However, nothing happened

I am so frustrated from this. anyone can help?

Sorry for bad writing, English is not my mother-language :(

4 Answers

for me, it was holding on deleting a directory called TMP_FETCH_FAILURES, which didn't exist. so I have created it then rerun and it worked.

Run brew update with debug option: brew update -d, to see what happens, where it hangs.

It might be caused by:

  • the slow network.
  • the waiting for the transferring of a big update.
  • the firewall issue.

After you found the command where it hangs, try to run the exact command in the exact terminal, to debug the issue.

If it's related to a firewall issue, you can try to use a proxy server in the command line.

For example, you have a http proxy server available at 127.0.0.1:6152. You can set it for git:

git config --global http.proxy http://127.0.0.1:6152
git config --global https.proxy http://127.0.0.1:6152
brew update -d

Or set the proxy for the whole command line(only for the commands that support proxy):

export https_proxy=http://127.0.0.1:6152
export http_proxy=http://127.0.0.1:6152
brew update -d

To undo the above proxy config, use:

git config --global --unset http.proxy
git config --global --unset https.proxy

Or

unset https_proxy http_proxy

For me I just ran it again and it worked. I did use -d but that shouldn't matter.

I also ran,

mkdir /usr/local/Homebrew/.git/TMP_FETCH_FAILURES

and it worked for me

Related