41

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

geo
  • 821
  • 1
  • 8
  • 15
  • 1
    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. – Mark Setchell Mar 29 '21 at 19:17
  • 1
    It really helps me to run Activity Monitor. That way, I can see that despite the silence something is actually happening. :) – matt Jul 10 '22 at 23:41
  • https://stackoverflow.com/a/64840631/1346610 – chandlervdw Oct 31 '22 at 14:49

8 Answers8

99

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.

noam ban ishay
  • 1,091
  • 1
  • 3
  • 3
  • 1
    I don't have a directory but a file named TMP_FETCH_FAILURES, should I delete it and make a directory instead? – Avantika Banerjee Feb 09 '22 at 15:48
  • 39
    Thanks. To be clear I ran, `mkdir /usr/local/Homebrew/.git/TMP_FETCH_FAILURES` and it worked like a charm. – Farid Nouri Neshat Feb 21 '22 at 13:01
  • 5
    /usr/local/Homebrew/.git/TMP_FETCH_FAILURES is supposed to be a file, not a folder. Else, `brew upgrade` will throw some errors. – user1771485 Apr 25 '22 at 07:47
  • 6
    I used `touch /usr/local/Homebrew/.git/TMP_FETCH_FAILURES` instead of `mkdir` for the reason that @user1771485 pointed out. It worked. – Abel Callejo Apr 29 '22 at 05:52
  • 7
    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. – Akshay Gaur Jul 13 '22 at 20:59
  • 21
    on my mac M1, this fixed the issue : `mkdir /opt/homebrew/Library/Taps/homebrew/homebrew-core/.git/TMP_FETCH_FAILURES` – KeatsPeeks Nov 14 '22 at 10:51
  • 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. touch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask/.git/TMP_FETCH_FAILURES /usr/local/Homebrew/.git/TMP_FETCH_FAILURES – nortally Jan 28 '23 at 05:07
  • 1
    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. – John Humphreys Feb 14 '23 at 13:43
  • 3
    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](https://github.com/Homebrew/brew/issues/14187#issuecomment-1334624189) on brews GitHub – Corey Feb 19 '23 at 03:52
39

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
alex
  • 799
  • 7
  • 8
  • 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). – edan May 18 '22 at 21:50
  • 4
    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. – Mentalist Aug 10 '22 at 13:30
  • 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! – John Humphreys Feb 14 '23 at 13:46
12

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

Rafael Emshoff
  • 2,541
  • 1
  • 35
  • 47
8

I also ran,

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

and it worked for me

IfeOdy
  • 81
  • 1
  • 2
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.

Art Ginzburg
  • 103
  • 1
  • 6
  • 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. – AdamE Feb 10 '23 at 18:43
1

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

G. Casey
  • 59
  • 3
1

Just tried to install watchman and its been going on for 30 mins. Keeps updating dependency after dependency, almost feels like I just installed the next mac OS version. Funny to see people normalising this DX, giving all the reasons why this is necessary / unavoidable / configurable.

Abhijeet Khangarot
  • 1,281
  • 1
  • 16
  • 25
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

Cris
  • 41
  • 1
  • 4