Brew upgrade get stuck in `removing...`

it’s stuck more than one minute for sure… and I’ve caught it stuck more than one hour there. In general when it’s there for a while —more than 10’— I usually ctrl-c it and that’s it.

How many packages do you all have installed (brew list | wc -l)? Do you have SSDs?

353 packages, yes to SSD.

356 packages and yes too to de SSD.

It’s now been stuck for 90 minutes after upgrading poppler.

@MikeMcQuaid you mentioned putsing a few things could help debugging - any suggestions for where we could place them?

@grischard I don’t have any specific locations in mind but you can start in cmd/upgrade.rb and “work down”.

I have been experiencing the same problem for some months now. I will try to contribute doing my own analysis (I hope to be able to) and take a place here to be updated on the issue.

I followed most of the advice in this thread, and it seemed to have fix the problem. It looked it was hanged but in reality it was solving some process. However, the last three days it has been hanging for hours at the following point:

==> Checking dependents for outdated formulae
==> No dependents to upgrade
==> Checking dependents for broken library links

I am not sure why this is happening. I hope someone may be able to help.

Just wanted to chime in and say that I update my system every morning, and a week or so ago I started having the problem described above: It hangs at:

Checking dependents for broken library links

and does so for five or six hours (it does eventually complete). It seems not to be related to what is being upgraded.

I do have HOMEBREW_INSTALL_CLEANUP=1 set, and I also install everything with the --build-from-source flag. I suppose I can unset routine cleanups and only do it once in awhile as an all-night process, but I suspect something is actually wrong here . . .

I also notice that whatever process is hanging is taking up a ton of memory and doesn’t seem to be niced down (very much). The system is hard to operate when it’s doing this.


Do you have any of the offending libraries —R, Cairo, or anything form osgeo?

I have cairo, but not R. I don’t think I have anything from osgeo (I don’t do that kind of work), but there are a lot of different packages there and I may have a library dependency somewhere . . .

But do you have the Homebrew-core’s cairo, or Seth’s one?

Core. In fact, I don’t have any non-core taps.

I’m having trouble understanding what this process is supposed to be doing. I can think of lots things that “checking . . . for broken library links” might mean, but very few of them involve processes taking up almost all the available memory for over six hours.

Does anyone know what is actually happening when we see this message? The word “link” can mean lots of different things here . . .

1 Like

I have cairo and R, and almost all of osgeo. I need QGIS. Is there something else that can be tried in case of having this libs/apps installed? By the way, I have core cairo. Cannot find any other version, at least with the active taps that I have.


this bug just happened to me while upgrading ffmpeg (of which cairo is a dependency)

My 9335-lines stacktrace makes me feel there is a loop in broken_dependents:

	9326: from /usr/local/Homebrew/Library/Homebrew/cache_store.rb:17:in `use'
	9325: from /usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:263:in `block in broken_dependents'
	9324: from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/set.rb:338:in `each'
	9323: from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/lib/ruby/2.6.0/set.rb:338:in `each_key'
	9322: from /usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:293:in `block (2 levels) in broken_dependents'
	9321: from /usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:262:in `broken_dependents'
	9320: from /usr/local/Homebrew/Library/Homebrew/cache_store.rb:17:in `use'

full stacktrace :


Yep, I also just got the same stack overflow. I was upgrading multiple things at once, but ffmpeg was among them. That said I was able to reproduce the issue again when upgrading openssl. Perhaps something to do with recursively upgrading dependents.

Was it an actual stack overflow crash or did you force quit the process like I did?

The first time threw a “stack level too deep” error. I had left it going for a little while.

The second time I didn’t bother leaving it that long as I knew what was coming.

1 Like

Same problem here, most of the time it happened when doing brew upgrade

This is a known problem being tracked in Don’t need more “same here” comments here, thanks.