Skip to content

Allow pinning casks #213583

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

Open
6 tasks done
Nowaker opened this issue May 24, 2025 · 2 comments
Open
6 tasks done

Allow pinning casks #213583

Nowaker opened this issue May 24, 2025 · 2 comments

Comments

@Nowaker
Copy link

Nowaker commented May 24, 2025

Verification

Description of issue

I'd like to re-raise #49127 and other tickets filed for this. I believe the original justification given doesn't address the problems that pinning would solve. Therefore, the topic requires a reconsideration.

@vitorgalvao

A huge chunk of casks auto-update and we can’t stop that. So pin would at best be inconsistent and not work in a lot of cases.

If you do a search you’ll see we’ve discussed this in the past, especially in the upgrade issues on brew’s repository.

Argument 1: a counter-argument to "pin would at best be inconsistent and not work in a lot of cases"

Casks with auto_updates are effectively pinned. brew upgrade will not update them, unless --greedy-auto-updates is passed. They may be upgraded externally by the application itself, and Homebrew won't know the actual version installed over time or what files were modified...

...so how is this different from an explicit pin on the package? auto_updates and latest markers are pins. Permanent ones that prevent them from being upgraded on brew upgrade - but still pins. They just can't be arbitrarily removed or added by the user to achieve their own goals.

Argument 2: auto-update feature is often optional, let brew do it

Out of all my auto_updates casks listed with brew info --json=v2 --installed --casks | jq -r '.casks[] | select(.auto_updates) | .token', most have optional auto-updates:

  • Check optional: iterm2, menumeters, nextcloud, orbstack, teamviewer, visual-studio-code, vlc, wireshark, witch
  • Check mandatory but update optional: firefox, imageoptim, macfuse, pika, sublime-text, xee, spectacle
  • Check and update mandatory: adobe-acrobat-reader, discord, dropbox, google-chrome, onedrive, signal

How do I update all packages except these listed in "Check and update mandatory" category, without this kind of trickery? brew upgrade --cask --greedy-auto-updates $(brew info --json=v2 --installed --casks | jq -r '.casks[] | select(.auto_updates) | .token' | grep -vE '^(adobe-acrobat-reader|discord|dropbox|onedrive|signal)$')

There is absolutely nothing wrong about brew pin adobe-acrobat-reader discord dropbox google-chrome onedrive signal so we can brew update --greedy-auto-updates and get everything up-to-date except the ones we pinned.

Argument 3: the fundamental issue

All package manager in existence - except pkgin/pksrc and Homebrew (for casks) - allow their users to "upgrade all except these":

  • pacman -Syu --ignore <pkg1>,<pkg2>
  • apt-mark hold <pkg1> <pkg2>; apt upgrade; apt-mark unhold <pkg1> <pkg2>
  • dnf upgrade --refresh --exclude=<pkg1>,<pkg2>
    • or dnf versionlock add <pkg1> <pkg2>; dnf upgrade --refresh; dnf versionlock delete <pkg1> <pkg2>
  • yum update --exclude=<pkg1>,<pkg2>
    • or yum versionlock add <pkg1>-* <pkg2>-*; yum update; yum versionlock delete <pkg1>-* <pkg2>-*
  • zypper up --exclude <pkg1>,<pkg2>
    • or zypper addlock <pkg>; zypper up; zypper removelock <pkg>
  • emerge -avuD --exclude <pkg1>,<pkg2> @world
    • or add =<pkg>-* to /etc/portage/package.mask
  • choco upgrade all --except=<pkg1>,<pkg2>
    • or choco pin add -n=<pkg>; choco upgrade all; choco pin remove -n=<pkg>
  • winget pin add --id <PackageID>; winget upgrade --all; winget pin remove --id <PackageID>
  • scoop hold <pkg1> <pkg2>; scoop update *; scoop unhold <pkg1> <pkg2>
  • port upgrade outdated and not <port>
  • brew pin something; brew upgrade; brew unpin something
    • (except for casks)

Why would one want to "upgrade all except these"? Every user has their own reasons. For me:

  1. I do it to skip large packages when my download speed is limited at that time. I tend to run pacman -Syu --ignore libreoffice-fresh,signal quite a bit.
  2. There are certain packages that I update myself. On Arch, I never update linux and linux-lts packages at the same time. linux-lts stays in IgnorePkg (it's pinned).
  3. For Homebrew specifically, I'd like to execute brew update --greedy-auto-updates and get everything upgraded except for those that perform mandatory updates. Whether that's via a permanent pin brew pin signal; brew update --greedy-auto-updates, or a one-time exclusion brew update --greedy-auto-updates --ignore pkg1,pkg2, it's all good.
  4. ...But most importantly: why not? All other package manager do it, and there must be many good reasons why.

Argument 4: by popular vote

Users have been requesting it all the time:

Users simply want this feature.


Thank you in advance for reconsidering this.

Command that failed

brew pin nextcloud

Output of command with --verbose --debug

nowaker@nwkr-m1pro ~ % brew pin nextcloud --verbose --debug
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::NullLoader): loading nextcloud
/opt/homebrew/Library/Homebrew/brew.rb (Formulary::NullLoader): loading nextcloud
Error: No available formula with the name "nextcloud".
/opt/homebrew/Library/Homebrew/formulary.rb:826:in 'Formulary::NullLoader#get_formula'
/opt/homebrew/Library/Homebrew/formulary.rb:931:in 'Formulary.factory'
...not relevant

Output of brew doctor and brew config

irrelevant

Output of brew tap

homebrew/cask-versions
homebrew/services
@bevanjkay
Copy link
Member

@Nowaker, Thanks for the detailed background here.
I think it is definitely something that could be beneficial for users and a worthwhile consideration.

Generally, with feature requests within Homebrew, they are moved forward when a contributor opens a pull request to get the process started. Is this something that you would have the capacity to have a look at?

@Nowaker
Copy link
Author

Nowaker commented May 24, 2025

@bevanjkay I could try my best, for sure. But in my view, the biggest issue with brew pin for casks wasn't lack of contributors, but rather, it was a direct disapproval of the feature itself. So it would be best to secure support from the Homebrew Cask's higher ups before investing time in coding. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants