2

Almost each time I install something using homebrew, after installing my desired package, it attempts to automatically delete presumably old packages. How can I stop this from occurring? I'm tired of fixing things I'm still using because of whatever logic is encoded into homebrew.

Is there a switch or config setting I can use to disable this behaviour (brew cleanup)?

EDIT Output when I installed pv

user@host:[ 3:03]$ brew install pv
Updating Homebrew...
==> Auto-updated Homebrew!
Updated Homebrew from 35f59eb3c to 4bbe34075.
Updated 7 taps (osrf/simulation, homebrew/cask-versions, homebrew/core, homebrew/cask, homebrew/bundle, homebrew/services and adoptopenjdk/openjdk).
==> New Formulae
apt                      cruft                    fanyi                    joplin-cli               newrelic-infra-agent     ots                      pari-galpol              procps                   singularity              xsel
aws-vault                docuum                   firefoxpwa               libaec                   onedrive                 pari-elldata             pari-seadata             pyoxidizer               spot
bupstash                 eigenpy                  i2c-tools                mailcatcher              opensearch-dashboards    pari-galdata             pari-seadata-big         rsc_2fa                  xauth
==> Updated Formulae
Updated 1023 formulae.
==> Renamed Formulae
prestosql -> trino
==> Deleted Formulae
terraform-provisioner-ansible                                                                                                  tj
==> New Casks
betterdiscord-installer             foxglove-studio                     kdocs                               open-video-downloader               temurin                             transfer                            wifi-explorer-pro
blackhole-64ch                      gosign                              leapp                               shottr                              temurin11                           trezor-suite                        wing-personal
clay                                jiohome                             midi-router-client                  stork                               temurin8                            vym                                 zebra2
==> Updated Casks
Updated 684 casks.
==> Deleted Casks
3cxphone                    anytrans-for-android        deadbeef                    macclean                    phoneclean                  phonetrans                  spectrum                    uberconference              youtube-dl-gui
anytrans                    baiducloud                  imobie-m1-app-checker       phonebrowse                 phonerescue                 postgres-beta               superbeam                   wingpersonal


==> Homebrew was updated to version 3.2.8
The changelog can be found at:
  https://github.com/Homebrew/brew/releases/tag/3.2.8
==> Downloading https://ghcr.io/v2/homebrew/core/pv/manifests/1.6.6-1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pv/blobs/sha256:9bb586c4dab67989e7fa800e7c764d1d4ee153db8ad7a5ed3563270ca93a7497
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:9bb586c4dab67989e7fa800e7c764d1d4ee153db8ad7a5ed3563270ca93a7497?se=2021-08-20T10%3A15%3A00Z&sig=w9ejSn6NMsklM8vDAsWuJ1vv5MjiW3cYS4Cca7bPWHI%3D&sp=r&spr=https&sr=b&sv=2
######################################################################## 100.0%
==> Pouring pv--1.6.6.catalina.bottle.1.tar.gz
🍺  /usr/local/Cellar/pv/1.6.6: 5 files, 112.8KB
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /Users/user/Library/Caches/Homebrew/c-ares--1.17.1... (162.9KB)
Removing: /Users/user/Library/Caches/Homebrew/eigen--3.3.9... (1.1MB)
Removing: /usr/local/Cellar/ghostscript/9.52... (1,678 files, 69.3MB)
Error: Directory not empty @ dir_s_rmdir - /usr/local/Cellar/ghostscript/9.52
5
  • 2
    Can you include the command you're using and the output from homebrew when it wants to delete things? - Homebrew shouldn't automatically start deleting installed packages.
    – jksoegaard
    Aug 20 at 10:46
  • 1
    The brew cleanup at the end doesn't remove installed packages, it removes old downloads from the cache.
    – nohillside
    Aug 20 at 11:14
  • Another example I had to fix recently: I installed pcre2. During the install, brew also installed gcc11 and while doing so removed my automatically installed gcc10 in the process but changed the gcc@10 symlink to point to the gcc11 install). This created a problem for me because in the interim, I had built some libraries for my apache server that rely on gcc10. I wasn't aware this change was going to occur when I installed pcre2, nor that it had occurred, and this caused my apache server to stop working, which took a while to figure out why. (Perhaps I should rephrase my question then?)
    – gone
    Aug 20 at 11:47
  • Perhaps I should rephrase my question?
    – gone
    Aug 20 at 11:47
  • You can force install gcc@10 when needed an pin it or just have both installed.
    – bmike
    Aug 20 at 14:06
1

Making sure autoupdate is not running is a pre-requisite, most people will not have opted in to this, though.

brew autoupdate stop

Next, you may want to pin your installs as soon as they happen or call for an older version that doesn’t let the auto update run at install time. You are being affected by a change that many people wanted to ensure they get security updates. Assuming pinning works for you, you might still let the rest of the system upgrade regularly and not have to hack the script to change its behavior.

brew pin pv 
2
  • Thanks for looking into this. I tried brew autoupdate stop but brew tells me it's not running. Also, from the comments above and some more detailed digging into what happened, it appears that my issue also has to do with auto-updates of dependencies. I've become quite adept at creating symlinks in newer library versions that point to older versions, however I'm getting frustrated with the lack of transparency with regards to what brew is going to do to my system when I ask to install something seemingly unrelated. This is important for me as I build my own binaries from time to time.
    – gone
    Aug 20 at 11:59
  • Yes @gone they certainly are making some new architectural decisions. Pinning and forcing an install to build from source is the way for you to do this. Also, attaching a hard drive with time machine backup and keeping the intermediate build products would ensure you capture the code needed to rebuild any version.
    – bmike
    Aug 20 at 14:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .