why Updating homebrew takes forever?

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