Homebrew slow/hangs

(Izaak Beekman) #1

It seems that Homebrew is hanging for me when I try to perform any operation. Even brew info gcc seems to hang. Again, using activity monitor, it looks like it’s hanging on curl and head, each taking up almost exactly 50% CPU.

My ISP connectivity seems to be fine: http://www.speedtest.net/my-result/6522512274

Any way to determine the source of this issue? Seems like it may be related to EDIT: RESOLVED: Brew search super slow/hangs on curl or perhaps blaming my ISP was incorrect then… (I am pleased to report my ISP is much better now than it was then)

Any thoughts on how to debug/trace this issue?

(Mike McQuaid) #2

It seems likely it’s hanging on analytics calls. I’m thinking it’s something in your .curlrc, proxy settings or, sadly, ISP.

(Izaak Beekman) #3

Rebooting my machine may have fixed it… or maybe it was what you said… thanks!

(Grahammorehead) #4

brew has been very slow for me for a while. I’m using a Macbook pro purchased new from the Apple store less than 6 months ago.

For a while I chalked it up to the fact that I had many different packages on here, but then I had some kind of OS failure and today the Apple store re-imaged the drive. Just about the first thing I did after that was to install homebrew.

Installing the original software was about 5 min, but then I quickly realized that brew is still super slow. Each of these commands required about 15 minutes:

brew install git
brew install zsh

As these were the first commands run on a newly imaged Macbook pro with an SSD and good internet connection, I don’t know what could be the issue.

Is brew running slowly for anyone else?

(Izaak Beekman) #5

I haven’t had any issues in quite some time. When you took your Macbook in for the “some kind of OS failure” did they run any hardware diagnostics? Also did you restore from a backup like time machine or start afresh?

It’s hard to say what’s going on for sure, without additional information. I wonder if HOMEBREW_BUILD_FROM_SOURCE might be set in your environment? If not, then a good place to start is to use activity monitor to see which processes are taking up all the CPU when brew is being sluggish. Also providing the output of brew config might give us some extra information and running brew doctor (if it doesn’t freeze up) may also be informative.

FWIW, I’m not sure how/why my previous issue went away. It is possible that my ruby environment was messed up (happens to me from time to time) or that there was some other issue.

(Grahammorehead) #6

Please Help. Homebrew has been hopelessly slow for me since some time in 2017. Nothing has resolved it. I’ve tried:

  1. reinstalling
  2. wiping hard drive, fresh OS install
  3. upgrading to next OS twice (no on Mojave)
  4. getting a new machine Macbook pro 15" (purchased Feb 2018)
  5. many different internet connections

Brew is still sooooo slooowwww.

No, HOMEBREW_BUILD_FROM_SOURCE is not set. When I look at activity monitor, brew isn’t doing much. It’s not using the CPU much and it’s not using the network in any non-negligible way.

Just to give an idea of how slow, this honkin’ huge file :wink: took over 30 minutes to install:

==> Summary
:beer: /usr/local/Cellar/libffi/3.2.1: 16 files, 296.8KB
==> Installing sshfs dependency: pcre
==> Downloading homebrew.bintray. com/bottles/pcre-8.42.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring pcre-8.42.mojave.bottle.tar.gz
:beer: /usr/local/Cellar/pcre/8.42: 204 files, 5.5MB

My download speed is 50Mb/s. Running brew doctor returns:

brew doctor
Your system is ready to brew.

Here’s my config:

brew config
ORIGIN: github .com/Homebrew/brew
HEAD: 422257067cc46d86138baa0e8e453348c2829cee
Last commit: 35 hours ago
Core tap ORIGIN: github .com/Homebrew/homebrew-core
Core tap HEAD: 388425f191fb3dc7effd3863d86aec7ee5700f6d
Core tap last commit: 5 hours ago
CPU: octa-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1000
Git: 2.18.0 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
macOS: 10.14.1-x86_64
Xcode: 10.1

(Izaak Beekman) #7

@grahammorehead sorry to hear about your troubles and sorry for the radio silence.

I recently was experiencing sluggishness with some commands that require git to run, e.g., brew log <formula>. I noticed a rather large speedup by going through my taps and explicitly running git gc in them. Also, I’m not 100% on this, but it’s possible homebrew uses your users .gitconfig and something in there could be causing slow git operations. Another thing to try would be to move or rename your ~/.gitconfig and see if that makes a difference.

It’s hard to tell precisely what’s going on, and where the source of the slowness is. First off I would look and make sure you have sufficient free disk space, an internet connection that’s behaving itself, and that you don’t have any zombie daemons/processes, or that the kernel is firing up spindump.

After that you can try brew prof <cmd> to try to localize where homebrew is spending its time.

(Izaak Beekman) #8

Oh, and also, I know that on my system my Anti Virus and Anti-Malware software can sometimes bog things down by, e.g., restricting deletion or moving of files etc. It might be worth testing with Bitdefender, RansomWhere, etc. disabled.