Every time I need to update anything on brew, I end up updating thousands of packages and it goes on and on for a long time.
brew update && brew upgrade && brew autoremove && brew cleanup && brew doctor
Running this every few days and fixing everything that it explicitly complains about kept me issue-free for the last 10 years or so.Lately I'm running this like once every 2-3 weeks and it's still surprisingly nice to use. The problems only really manifest when you never run this "maintenance" snippet and only use the `brew install`, which will attempt to do the housekeeping stuff when you want/expect it the least.