Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove automatic package updates when running "brew install" #9285

Closed
brummetj opened this issue Nov 24, 2020 · 8 comments
Closed

Remove automatic package updates when running "brew install" #9285

brummetj opened this issue Nov 24, 2020 · 8 comments
Labels
outdated PR was locked due to age

Comments

@brummetj
Copy link

Feature suggestion

Lets have brew package manager not update packages everytime you command line "brew install" as default. Remove this having no required environsym, and only update when calling "brew update/upgrade"

A detailed description of the proposed feature

Today by default, everytime you install a new package, brew will go ahead and automatically update all of my system packages to their latest versions. I propose to switch this or remove this completely and only have homebrew update packages when requested. This has caused issues over and over again and im sure im not the only one. The reason this is a bad design is because most of the time development packages are version specific.

I know there is the environsym to tell homebrew to not upgrade but i believe that this shouldn't be a requirement to stop the automatic updates. The package manager should only upgrade when told to! I dont know any other package manager that does this... pip, yum, apt-get ect ect.

Remove the environsym, stop the automatic updates, and only update packages when told to.

The motivation for the feature

When homebrew updates all my system packages, i have to first huntdown what the package was. Next find out what the previous version of the package was, uninstall the newest version, find and install the older version, unlink the newest version and relink the older version. Usually takes about 10 times of the right ordering of this process to get things back to working. But theres a chance, that the older version of the package isn't even available, breaking all APIs and forcing a version update. Not very fun!

Heres an example iv been dealing with over and over... im sitting on python3.7 on my manage macs for automation servers. Everytime i need to use brew to install something new and i leave it running.... the homebrew decides i need to go install python@3.8 because im on 3.7. Why would this ever be a thing? Who would go update a required python version like that? This then breaks all of my python site-packages and i have to spend a couple hours of my day break fixing 60 managed mac computers to get the API's up and running again.

I do have the environsym on macs HOMEBREW_NO_AUTO_UPDATE=1, but i do still see this happen time to time when installing via brew.

How the feature would be relevant to at least 90% of Homebrew users

I'm sure every user of homebrew has ran into this issue before when they use homebrew for package managing on the darwin systems as a developer. Versions sometimes need to be specific, and when that version gets updated and breaks their APIs, they need to track down and figure out what brew did to cause this. I have seen countless forums on running brew commands to fix broken versioning.

What alternatives to the feature have been considered

I know there is the HOMEBREW_NO_AUTO_UPDATE=1 environsym available to tell homebrew to skip the updating. Which is fine, but what im requesting is to remove this and have it not auto update by default. To the best of my knowledge i don't know what other alternatives are out there to stop the auto updating.

@vitorgalvao
Copy link
Member

Today by default, everytime you install a new package, brew will go ahead and automatically update all of my system packages to their latest versions.

It won’t. You’re either conflating things or bumping against a bug I haven’t seen mentioned, or have something misconfigured. There’s a huge difference between update and upgrade. The latter installs the new version of the software but the former only gets package definitions (i.e. the formulae and casks which tell HB how to do its job for each piece of software).

That’s the extent of HB’s autoupdate. It doesn’t upgrade packages for you, it just ensures you’re on the latest package definitions, which makes sense for several reasons. When installing something for the first time, you usually want the latest version, and tons of bugs are solved by running update, which users tend to forget to do manually.

@Rylan12
Copy link
Member

Rylan12 commented Nov 25, 2020

First of all, Homebrew is an evergreen package manager which means that we (in most cases) only support the latest version. This has been discussed in issues countless times and isn't going to change.

Secondly, are you mixing up brew update and brew upgrade? To my knowledge, brew install will automatically run brew update, not brew upgrade. The difference being that update only updates Homebrew's repositories but does not upgrade any formulae. In most cases, you can choose not to upgrade most formulae to the latest version by simply not running brew upgrade. If there's a specific formula you want to upgrade, run brew upgrade <formula> to avoid upgrading other formulae that you don't want to upgrade.

Have you tried using brew pin? If not, that may be what you're looking for. Running brew pin <formula> will tell Homebrew not to upgrade that formula even if a new version is available.

In terms of the Python issue, you may not be able to avoid installing a newer version of Python because lots of formulae depend on the latest Python version. However, you can install both python@3.9 (the latest version) and python@3.7 to still use Python 3.7. Note that if you installed python using brew install python, Homebrew will automatically point to the latest version of python. You can instead run brew install python@3.7 which will tell Homebrew that you only want version 3.7 and not to automatically upgrade to 3.9 (this is a Python-specific feature).

Additionally, it's very easy to maintain your own, personal, tap that can contain whatever versions you want. The brew extract command will make extracting the formulae for previous versions very easy. We've got some great documentation available explaining how to do this.

Lastly, as you mentioned, we do have a HOMEBREW_NO_AUTO_UPDATE environment variable. Simply set that variable in your ~/.bashrc or ~/.zshrc and move on.

@jonchang
Copy link
Contributor

We’re not going to do this as automatic updates have significantly reduced the amount of support requests that maintainers need to handle. The methods for turning off automatic updates are documented already as you point out in your issue description.

@scpeters
Copy link
Member

There is another way that a brew install can trigger an upgrade of other packages: if the HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK environment variable is not set, then Upgrade:: check_installed_dependents will check for any dependents of that package with broken linkage and upgrade them. This is called by brew install and probably brew reinstall and brew upgrade as well. We do this to try to fix packages that look broken. If you want to disable this, then you can set HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK as well.

@MikeMcQuaid
Copy link
Member

If you want to disable this, then you can set HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK as well.

If you do this, though, note that brew install and brew upgrade will break existing installed packages sometimes.

@gMan1990
Copy link

gMan1990 commented Nov 29, 2020

Heres an example iv been dealing with over and over... im sitting on python3.7 on my manage macs for automation servers. Everytime i need to use brew to install something new and i leave it running.... the homebrew decides i need to go install python@3.8 because im on 3.7. Why would this ever be a thing? Who would go update a required python version like that? This then breaks all of my python site-packages and i have to spend a couple hours of my day break fixing 60 managed mac computers to get the API's up and running again.

  • So do I. Packages installed by python3 -m pip may remove by brew.
> python3 -m pip --version
pip 19.1.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
  • Now I know, do not use brew install python/python3/python@3, a special version is better brew install python@3.7
> brew desc python/python3/python@3
python@3.8: Interpreted, interactive, object-oriented programming language
> brew desc python@3.7
python@3.7: Interpreted, interactive, object-oriented programming language

> brew ls --versions|grep -F 'python'
python 3.7.4_1
> brew ls --full-name|grep -F 'python'
python@3.8
  • How do I pin my python?
> for i in python python3 python@3 python@3.8 python@3.7
      echo $i && brew pin $i && brew unpin $i
  end
python
Warning: python@3.8 not pinned
python3
Warning: python@3.8 not pinned
python@3
Warning: python@3.8 not pinned
python@3.8
Warning: python@3.8 not pinned
python@3.7
Error: python@3.7 not installed
Error: python@3.7 not installed

@thepatrick
Copy link

I hit this today - doing what seemed like a simple brew install cfn-lint resulted in losing 10 minutes (longer because now I'm out of the flow of what I was doing) while brew proceeded to upgrade a bunch of completely unrelated packages.

==> Upgrading 12 dependents:
ansible 2.9.6_1 -> 2.10.4, awscli 2.0.4 -> 2.1.15, glib 2.64.2_1 -> 2.66.4, graphviz 2.44.0 -> 2.44.1, harfbuzz 2.6.5_1 -> 2.7.4, pango 1.44.7 -> 1.48.0, pyenv 1.2.17 -> 1.2.21, python@3.8 3.8.2 -> 3.8.7, ruby 2.7.0 -> 3.0.0_1, thefuck 3.30 -> 3.30_1, vim 8.2.0400 -> 8.2.2200_2, yubico-piv-tool 2.0.0 -> 2.1.1

If I wanted this I would have run brew upgrade.

@carlocab
Copy link
Member

There's a brief explanation of what's happening in the FAQ: https://docs.brew.sh/FAQ#why-does-brew-upgrade-formula-also-upgrade-a-bunch-of-other-stuff

Feel free to ask if anything there is unclear.

@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Jan 31, 2021
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Jan 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

10 participants