why Updating homebrew takes forever?
Asked Answered
C

9

53

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 :(

Chaperone answered 29/3, 2021 at 17:51 Comment(3)
Please click edit under your question and format it properly. To format code, select it all with your mouse then click {} in the Formatting Toolbar beside Bold and Italic. Thank you.Audition
It really helps me to run Activity Monitor. That way, I can see that despite the silence something is actually happening. :)Poinciana
https://mcmap.net/q/209382/-homebrew-fails-on-macos-big-surPrivy
M
47

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
Mita answered 30/3, 2021 at 1:19 Comment(3)
I have the pleasure helping dozens of students every year use brew on their personal laptops. I can tell you, this is generally not caused by slow networks or large file downloads. Homebrew is predictably extremely slow (brew update takes several minutes) and buggy (works the first time for maybe 70% of students).Mallen
To developers: when composing a README instructing users on how to install your software, please don't list brew install as the first option. I enthusiastically initiated a brew install and have been sitting here for almost an hour watching homebrew update itself, count objects, compress objects, receive objects (whatever these things mean?)... and the simple plugin I was trying to install is still not installed. Reading a little further down in the README, I now realize I could have simply grabbed a .zip from GitHub's "Releases" and been done long ago. Keep it simple for users.Graycegrayheaded
The proxy server thing worked like a charm, after much suffering thinking it was blocked on the "file touch" in other answers. Adding -d made it look like it was blocked on the touched btw, even though the proxy was the solution. Thanks!Fideliafidelio
F
113

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.

Footnote answered 16/12, 2021 at 20:12 Comment(10)
I don't have a directory but a file named TMP_FETCH_FAILURES, should I delete it and make a directory instead?Undertook
Thanks. To be clear I ran, mkdir /usr/local/Homebrew/.git/TMP_FETCH_FAILURES and it worked like a charm.Clasping
/usr/local/Homebrew/.git/TMP_FETCH_FAILURES is supposed to be a file, not a folder. Else, brew upgrade will throw some errors.Korella
I used touch /usr/local/Homebrew/.git/TMP_FETCH_FAILURES instead of mkdir for the reason that @Korella pointed out. It worked.Upstage
The TMP_FETCH_FAILURES could also be located in: /opt/homebrew/.git/TMP_FETCH_FAILURES. So please use brew update -d to see where the process gets stuck in your case.Foray
on my mac M1, this fixed the issue : mkdir /opt/homebrew/Library/Taps/homebrew/homebrew-core/.git/TMP_FETCH_FAILURESRaylenerayless
Upvoting for the refinements in the comments. After using the -d option, I settled on the following. There was still a delay after at one of the files, but only 90 seconds or so. <code>touch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/.git/TMP_FETCH_FAILURES /usr/local/Homebrew/.git/TMP_FETCH_FAILURES</code>Crozier
In my case, unfortunately, I see it hangs on this file but touching it or mkdiring it does not help at all (just so others don't feel nuts). Tried it while it was stuck in parallel CI, and tried it before running update.Fideliafidelio
None of the steps above worked for me. I ran brew update-reset which takes about 4 minutes and it solved the issue for me. I found a fix from this issue on brews GitHubDipeptide
I'm running an old macbook air and did brew update -d found I had to make a directory. Don't putz around with making the file because it kept hanging for mePolard
M
47

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
Mita answered 30/3, 2021 at 1:19 Comment(3)
I have the pleasure helping dozens of students every year use brew on their personal laptops. I can tell you, this is generally not caused by slow networks or large file downloads. Homebrew is predictably extremely slow (brew update takes several minutes) and buggy (works the first time for maybe 70% of students).Mallen
To developers: when composing a README instructing users on how to install your software, please don't list brew install as the first option. I enthusiastically initiated a brew install and have been sitting here for almost an hour watching homebrew update itself, count objects, compress objects, receive objects (whatever these things mean?)... and the simple plugin I was trying to install is still not installed. Reading a little further down in the README, I now realize I could have simply grabbed a .zip from GitHub's "Releases" and been done long ago. Keep it simple for users.Graycegrayheaded
The proxy server thing worked like a charm, after much suffering thinking it was blocked on the "file touch" in other answers. Adding -d made it look like it was blocked on the touched btw, even though the proxy was the solution. Thanks!Fideliafidelio
Y
19

This is what fixed it for me:

cd /usr/local/Homebrew/Library/Taps/homebrew/
rm -rf homebrew-core
git clone https://github.com/Homebrew/homebrew-core.git

Then run update again:

brew update -d --auto-update --verbose --force --debug

Source: https://discussions.apple.com/thread/253961400

Yap answered 13/2, 2023 at 19:19 Comment(3)
this homebrew-core's git is really the culprit, but more importantly this solution flow is the best fix out of all answersLeslileslie
Not sure how this worked, but it worked like a charm. Thank you so much!Hygrometric
Worked for me. I also used git clone https://github.com/Homebrew/homebrew-core.git --depth 1 to avoid wasting a bunch of space on the repo historyLodmilla
S
8

I also ran,

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

and it worked for me

Soracco answered 6/9, 2022 at 12:55 Comment(0)
H
7

I've had the "hanging brew update" issue once, and tried everything suggested in the answers to this date, including:

  • Turning off my Firewall — nothing changed
  • Using a proxy server — brew update just failed to start fetching the repositories
  • Messing with the TMP_FETCH_FAILURES file/directory — nothing changed
  • Running git remote-https origin https://github.com/Homebrew/homebrew-core — the command hanged
  • Restarting macOS (that helps more often than one would expect) — nothing changed
  • Running brew cleanup, brew autoremove — unrelated to this topic, was just trying things. Nothing changed in the behaviour of brew update
  • Running brew doctor — nothing changed

The only thing that worked in the end is visiting https://brew.sh/#install and running the provided install script again. The issue just evaporated.

Headspring answered 29/12, 2022 at 11:46 Comment(1)
My clock was out of date when trying to install brew again, but after I corrected the clock, was able to reinstall brew. Thanks.Tamar
G
1

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

Godric answered 8/1, 2022 at 19:52 Comment(1)
Me also. I ran it after restarting mac and it worked.Savino
F
0

Mine was weird, I ran brew update -d --auto-update --verbose --force --debug, and when it hang I ran:

Criss-MacBook-Air:~ cris$ ps -a | grep brew
12161 ttys000    0:00.12 tclsh /opt/homebrew/bin/unbuffer brew update -d --force --verbose --auto-update
12163 ttys001    0:00.03 /bin/bash /opt/homebrew/Library/Homebrew/brew.sh update -d --force --verbose --auto-update
12402 ttys001    0:00.00 /bin/bash /opt/homebrew/Library/Homebrew/brew.sh update -d --force --verbose --auto-update
12462 ttys001    0:00.00 /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git remote-https origin https://github.com/Homebrew/homebrew-core
12464 ttys001    0:00.06 /Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/git-remote-https origin https://github.com/Homebrew/homebrew-core
13090 ttys002    0:00.00 grep brew

git-remote-https matched the job title in the shell window, too.

Then I just weirdly ran:

git remote-https origin https://github.com/Homebrew/homebrew-core

Which somehow kickstarted it out of its stall and then the whole thing started chugging along again, and finished really quickly.

WEIRD

Fall answered 13/12, 2022 at 14:44 Comment(0)
B
0

This is because apple tries to update many other unrelated things whenever you try to install something, but they make their download extremely slow to save bandwidth. Unfortunately there is no way to resolve it except for getting a different OS

Blond answered 24/3, 2024 at 5:29 Comment(0)
C
0

On running homebrew commands we don't get any logs so it is very confusing.

So we have to run it in debug mode

brew update -d

It gets stuck at

rm -f /opt/homebrew/.git/TMP_FETCH_FAILURES

Logs show that it is trying to delete a directory TMP_FETCH_FAILURES which doesn't exist. Hence it is not able to move forward. So we need to create a directory TMP_FETCH_FAILURES and manually delete it and run the command again.

Runs these to solve the above issue

cd

cd /opt/homebrew/.git

Check if the directory TMP_FETCH_FAILURES exist by listing

ls

If not then manually make a directory

mkdir TMP_FETCH_FAILURES

Then run the command again

brew update -d

This will solve the issue.

Confluent answered 16/7, 2024 at 7:54 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.