meta_package_manager.managers.homebrew module¶
- class meta_package_manager.managers.homebrew.Homebrew[source]¶
Bases:
PackageManagerVirtual base shared by the
BrewandCaskmanagers.Homebrew is the umbrella project behind the
brewCLI. mpm exposes it as two managers over that single binary:Brewfor formulae built from recipes, andCaskfor pre-built macOS applications, each pinning its half with a--formulaor--caskselector. This base holds the shared query, mutation and metadata logic; the concrete classes carry the manager-level narrative.Initialize
cli_errorslist.- platforms: frozenset[Platform] | Group | Platform | Iterable[Platform | Group] = frozenset({Platform(id='almalinux', name='AlmaLinux'), Platform(id='alpine', name='Alpine Linux'), Platform(id='altlinux', name='ALT Linux'), Platform(id='amzn', name='Amazon Linux'), Platform(id='android', name='Android'), Platform(id='arch', name='Arch Linux'), Platform(id='buildroot', name='Buildroot'), Platform(id='cachyos', name='CachyOS'), Platform(id='centos', name='CentOS'), Platform(id='chromeos', name='ChromeOS'), Platform(id='clearlinux', name='Clear Linux OS'), Platform(id='cloudlinux', name='CloudLinux OS'), Platform(id='debian', name='Debian'), Platform(id='endeavouros', name='EndeavourOS'), Platform(id='exherbo', name='Exherbo Linux'), Platform(id='fedora', name='Fedora'), Platform(id='generic_linux', name='Generic Linux'), Platform(id='gentoo', name='Gentoo Linux'), Platform(id='guix', name='Guix System'), Platform(id='ibm_powerkvm', name='IBM PowerKVM'), Platform(id='kali', name='Kali Linux'), Platform(id='kvmibm', name='KVM for IBM z Systems'), Platform(id='linuxmint', name='Linux Mint'), Platform(id='macos', name='macOS'), Platform(id='mageia', name='Mageia'), Platform(id='mandriva', name='Mandriva Linux'), Platform(id='manjaro', name='Manjaro Linux'), Platform(id='nixos', name='NixOS'), Platform(id='nobara', name='Nobara'), Platform(id='opensuse', name='openSUSE'), Platform(id='openwrt', name='OpenWrt'), Platform(id='oracle', name='Oracle Linux'), Platform(id='parallels', name='Parallels'), Platform(id='pidora', name='Pidora'), Platform(id='pikaos', name='PikaOS'), Platform(id='raspbian', name='Raspbian'), Platform(id='rhel', name='RedHat Enterprise Linux'), Platform(id='rocky', name='Rocky Linux'), Platform(id='scientific', name='Scientific Linux'), Platform(id='slackware', name='Slackware'), Platform(id='sles', name='SUSE Linux Enterprise Server'), Platform(id='slitaz', name='SliTaz GNU/Linux'), Platform(id='sourcemage', name='Source Mage GNU/Linux'), Platform(id='tuxedo', name='Tuxedo OS'), Platform(id='ubuntu', name='Ubuntu'), Platform(id='ultramarine', name='Ultramarine'), Platform(id='void', name='Void Linux'), Platform(id='wsl1', name='Windows Subsystem for Linux v1'), Platform(id='wsl2', name='Windows Subsystem for Linux v2'), Platform(id='xenserver', name='XenServer')})¶
Homebrew core is now compatible with Linux and Windows Subsystem for Linux (WSL) 2.
- requirement: str | None = '>=6.0.0'¶
Vanilla
brewandcaskCLIs now shares the same version.2.7.0 was the first release to enforce the use of
--caskoption.6.0.0 is the first release in which ask mode is the default for
brew installandbrew upgrade, and the first to ship the--yesopt-out flag that mpm relies on for non-interactive upgrades.
- virtual: bool = True¶
Should we expose the package manager to the user?
Virtual package manager are just skeleton classes used to factorize code among managers of the same family.
- extra_env: ClassVar = {'HOMEBREW_NO_ANALYTICS': '1', 'HOMEBREW_NO_AUTO_UPDATE': '1', 'HOMEBREW_NO_ENV_HINTS': '1'}¶
Additional environment variables to add to the current context.
Automatically applied on each
meta_package_manager.execution.CLIExecutor.run_cli()calls.
- version_regexes: tuple[str, ...] = ('Homebrew\\s+(?P<version>\\S+)',)¶
$ brew --version Homebrew 1.8.6-124-g6cd4c31 Homebrew/homebrew-core (git revision 533d; last commit 2018-12-28) Homebrew/homebrew-cask (git revision 5095b; last commit 2018-12-28)
- property installed: Iterator[Package]¶
Fetch installed packages.
$ brew list --versions --formula ack 2.14 apg 2.2.3 audacity (!) 2.1.2 apple-gcc42 4.2.1-5666.3 atk 2.22.0 bash 4.4.5 bash-completion 1.3_1 boost 1.63.0 c-ares 1.12.0 graphviz 2.40.1 2.40.20161221.0239 quicklook-json latest
$ brew list --versions --cask aerial 1.2beta5 android-file-transfer latest audacity (!) 2.1.2 firefox 49.0.1 flux 37.7 gimp 2.8.18-x86_64 java 1.8.0_112-b16 tunnelblick 3.6.8_build_4625 3.6.9_build_4685 virtualbox 5.1.8-111374 5.1.10-112026
Todo
Use the
removedvariable to detect removed packages (which are reported with a(!)flag). See #17.
- package_metadata_batch(packages)[source]¶
Enrich installed packages with Homebrew’s API + per-formula data.
Runs
brew info --json=v2 --installedin a single shell-out and joins the result back onto the inventory list by package ID. For each formula that has<prefix>/Cellar/<name>/<version>/sbom.spdx.jsonon disk (the file Homebrew writes when installed underHOMEBREW_SBOM=1), the metadata’sexternal_sbom_pathpoints at it so the SPDX renderer can splice the upstream document into the aggregate.Casks reuse the same JSON payload through the
casksarray but do not get the SBOM-file treatment (Homebrew does not emit one for casks).- Return type:
- property outdated: Iterator[Package]¶
Fetch outdated packages.
$ brew outdated --json=v2 --formula | jq { "formulae": [ { "name": "pygobject3", "installed_versions": [ "3.36.1" ], "current_version": "3.38.0", "pinned": false, "pinned_version": null }, { "name": "rav1e", "installed_versions": [ "0.3.3" ], "current_version": "0.3.4", "pinned": false, "pinned_version": null } ], "casks": [] }
$ brew outdated --json=v2 --cask | jq { "formulae": [], "casks": [ { "name": "electrum", "installed_versions": "4.0.2", "current_version": "4.0.3" }, { "name": "qlcolorcode", "installed_versions": "3.0.2", "current_version": "3.1.1" } ] }
$ brew outdated --json=v2 --greedy --cask | jq { "formulae": [], "casks": [ { "name": "amethyst", "installed_versions": "0.14.3", "current_version": "0.15.3" }, { "name": "balenaetcher", "installed_versions": "1.5.106", "current_version": "1.5.108" }, { "name": "caldigit-thunderbolt-charging", "installed_versions": "latest", "current_version": "latest" }, { "name": "electrum", "installed_versions": "4.0.2", "current_version": "4.0.3" }, { "name": "lg-onscreen-control", "installed_versions": "5.33,cV8xqv5TSZA.upgrading, 5.47,yi5XuIZw6hg", "current_version": "5.48,uYXSwyUCNFBbSch9PFw" } ] }
Note
Both the formula and cask payloads also carry
pinnedandpinned_versionfields. The formula payload has always emitted them; the cask payload has emitted them since at least5.1.15but they only became meaningful with Homebrew 6.0.0, which added brew pin <cask> so casks can now actually be pinned.mpmdiscards both fields today: pinned packages still appear inmpm outdatedoutput, andbrew upgradesilently skips them at upgrade time.Todo
Surface pin state, or let
mpm outdatedfilter on it, by reading thepinnedandpinned_versionfields the note above describes.
- search(query, extended, exact)[source]¶
Fetch matching packages.
Caution
Search does not supports extended mode.
$ brew search sed ==> Formulae gnu-sed âś” libxdg-basedir ==> Casks eclipse-dsl marsedit focused physicseditor google-adwords-editor prefs-editor licensed subclassed-mnemosyne
$ brew search sed --formulae ==> Formulae gnu-sed âś” libxdg-basedir
$ brew search sed --cask ==> Casks eclipse-dsl marsedit focused physicseditor google-adwords-editor prefs-editor licensed subclassed-mnemosyne
$ brew search python --formulae ==> Formulae app-engine-python boost-python3 python âś” python-yq boost-python gst-python python-markdown [email protected] âś”
$ brew search "/^ssed$/" --formulae ==> Formulae ssed
$ brew search "/^sed$/" --formulae Error: No formula or cask found for "/^sed$/".
$ brew search tetris --formulae --desc ==> Formulae bastet: Bastard Tetris netris: Networked variant of tetris vitetris: Terminal-based Tetris clone yetris: Customizable Tetris for the terminal
$ brew search tetris --cask --desc ==> Casks not-tetris: (Not Tetris) [no description] tetrio: (TETR.IO) Free-to-play Tetris clone
More doc in brew search.
- trust_tap(package_id)[source]¶
Trust the tap a third-party
package_idbelongs to.Homebrew 6.0.0 rejects code from third-party taps until the tap (or each formula or cask) has been explicitly trusted. Vanilla
brew installwould otherwise abort with atap trust is requiredwarning when the snapshot pins auser/tap/namepackage.Only fully-qualified package IDs (
user/tap/name) need this step: core formulae and casks live on the trustedhomebrew/coreandhomebrew/casktaps. The tap itself is registered first (idempotent if already tapped) sobrew trustcan resolve the formula or cask. The--formulaand--caskflag is supplied by the subclass’spost_args.$ brew tap gromgit/fuse $ brew trust gromgit/fuse/ntfs-3g-mac --formula
- Return type:
- install(package_id, version=None)[source]¶
Install one package.
Tap-qualified IDs (
user/tap/name) are routed throughtrust_tap()first so the install isn’t rejected by Homebrew 6.0.0’s tap-trust gate.$ brew install jpeginfo --formula ==> Downloading https://ghcr.io/core/jpeginfo/manifests/1.6.1_1-1 ############################################################## 100.0% ==> Downloading https://ghcr.io/core/jpeginfo/blobs/sha256:27bb35884368b83 ==> Downloading from https://pkg.githubcontent.com/ghcr1/blobs/sha256:27bb3 ############################################################## 100.0% ==> Pouring jpeginfo--1.6.1_1.big_sure.bottle.1.tar.gz 🍺 /usr/local/Cellar/jpeginfo/1.6.1_1: 7 files, 77.6KB
$ brew install pngyu --cask ==> Downloading https://nukesaq.github.io/Pngyu/download/Pngyu_mac_101.zip ################################################################## 100.0% ==> Installing Cask pngyu ==> Moving App 'Pngyu.app' to '/Applications/Pngyu.app' 🍺 pngyu was successfully installed!
- Return type:
- upgrade_all_cli()[source]¶
Generates the CLI to upgrade all outdated packages.
brewandcaskshare the same command, butcaskoverrides this method to append--greedywhen auto-updating packages are included.$ brew upgrade --formula ==> Upgrading 2 outdated packages: node 13.11.0 -> 13.12.0 sdl2 2.0.12 -> 2.0.12_1 ==> Upgrading node 13.11.0 -> 13.12.0 ==> Downloading https://homebrew.bintray.com/bottles/node-13.tar.gz ==> Downloading from https://akamai.bintray.com/fc/fc0bfb42fe23e960 ############################################################ 100.0% ==> Pouring node-13.12.0.catalina.bottle.tar.gz ==> Caveats Bash completion has been installed to: /usr/local/etc/bash_completion.d ==> Summary 🍺 /usr/local/Cellar/node/13.12.0: 4,660 files, 60.3MB Removing: /usr/local/Cellar/node/13.11.0... (4,686 files, 60.4MB) ==> Upgrading sdl2 2.0.12 -> 2.0.12_1 ==> Downloading https://homebrew.bintray.com/bottles/sdl2-2.tar.gz ==> Downloading from https://akamai.bintray.com/4d/4dcd635465d16372 ############################################################ 100.0% ==> Pouring sdl2-2.0.12_1.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/sdl2/2.0.12_1: 89 files, 4.7MB Removing: /usr/local/Cellar/sdl2/2.0.12... (89 files, 4.7MB) ==> Checking for dependents of upgraded formulae... ==> No dependents found! ==> Caveats ==> node Bash completion has been installed to: /usr/local/etc/bash_completion.d
$ brew upgrade --cask ==> Casks with ``auto_updates`` or ``version :latest`` will not be upgraded ==> Upgrading 1 outdated packages: aerial 2.0.7 -> 2.0.8 ==> Upgrading aerial ==> Downloading https://github.com/Aerial/download/v2.0.8/Aerial.saver.zip ==> Downloading from https://65be.s3.amazonaws.com/44998092/29eb1e0 ==> Verifying SHA-256 checksum for Cask 'aerial'. ==> Backing Screen Saver up to '/usr/local/Caskroom/Aerial.saver'. ==> Removing Screen Saver '/Users/kde/Library/Screen Savers/Aerial.saver'. ==> Moving Screen Saver to '/Users/kde/Library/Screen Savers/Aerial.saver'. ==> Purging files for version 2.0.7 of Cask aerial 🍺 aerial was successfully upgraded!
--yesskips the interactive confirmation prompt thatbrewshows by default since ask mode became the default behaviour.
- upgrade_one_cli(package_id, version=None)[source]¶
Generates the CLI to upgrade the provided package.
brewandcaskshare the same command.$ brew upgrade dupeguru --cask ==> Upgrading 1 outdated package: dupeguru 4.2.0 -> 4.2.1 ==> Upgrading dupeguru ==> Downloading https://github.com/(...)/4.2.1/dupeguru_macOS_Qt_4.2.1.zip ==> Downloading from https://githubusercontent.com/production-release-asset ##################################################################### 100.0% ==> Backing App 'dupeguru.app' up to '/opt/homebrew/.../4.2.0/dupeguru.app' ==> Removing App '/Applications/dupeguru.app' ==> Moving App 'dupeguru.app' to '/Applications/dupeguru.app' ==> Purging files for version 4.2.0 of Cask dupeguru 🍺 dupeguru was successfully upgraded!
--yesskips the interactive confirmation prompt thatbrewshows by default since ask mode became the default behaviour.
- remove(package_id)[source]¶
Removes a package.
$ brew uninstall bat Uninstalling /usr/local/Cellar/bat/0.21.0... (14 files, 5MB)
- Return type:
- cleanup_orphan()[source]¶
Uninstall every formula installed as a dependency and no longer needed.
$ brew autoremove ==> Uninstalling 17 unneeded formulae: gtkmm3 highlight [email protected] nasm nghttp2 texi2html Uninstalling /usr/local/Cellar/nghttp2/1.41.0_1... (26 files, 2.7MB) Uninstalling /usr/local/Cellar/highlight/3.59... (558 files, 3.5MB) Warning: The following highlight configuration files have not been removed! If desired, remove them manually with ``rm -rf``: /usr/local/etc/highlight /usr/local/etc/highlight/filetypes.conf /usr/local/etc/highlight/filetypes.conf.default Uninstalling /usr/local/Cellar/gtkmm3/3.24.2_1... (1,903 files, 173.7MB) Uninstalling /usr/local/Cellar/texi2html/5.0... (279 files, 6.2MB) Uninstalling /usr/local/Cellar/[email protected]/5.1.5_8... (22 files, 245.6KB) Uninstalling /usr/local/Cellar/nasm/2.15.05... (29 files, 2.9MB)
- Return type:
- cleanup_cache()[source]¶
Scrub the cache, including latest version’s downloads.
Downloads for all installed formulae and casks will not be deleted.
$ brew cleanup --quiet --scrub --prune=all Removing: ~/Library/Caches/Homebrew/node--1.bottle.tar.gz... (9MB) Warning: Skipping sdl2: most recent version 2.0.12_1 not installed Removing: ~/Library/Caches/Homebrew/Cask/aerial--1.8.1.zip... (5MB) Removing: ~/Library/Caches/Homebrew/Cask/prey--1.9.pkg... (19.9MB) Removing: ~/Library/Logs/Homebrew/readline... (64B) Removing: ~/Library/Logs/Homebrew/libfido2... (64B) Removing: ~/Library/Logs/Homebrew/libcbor... (64B)
More doc in brew cleanup.
- Return type:
- doctor_cli()[source]¶
Generates the CLI running the native self-diagnosis.
brew doctorexits non-zero when it finds anything to warn about, and prints its findings on<stderr>. Likeautoremoveandcleanup, it takes no--formula/--caskselector.$ brew doctor Your system is ready to brew.
- cli_names: tuple[str, ...] = ('homebrew',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- class meta_package_manager.managers.homebrew.Brew[source]¶
Bases:
HomebrewThe formula half of Homebrew: command-line tools built from recipes.
Homebrew is the umbrella project behind the
brewCLI. mpm splits it into two managers over the same binary, this one for formulae andCaskfor macOS applications; a forced--formulaselector keeps every call on the formula side. Homebrew core runs on macOS and on Linux and WSL.mpm drives
brewnon-interactively and pins its environment: analytics and setup hints are silenced, andHOMEBREW_NO_AUTO_UPDATEkeepsbrewfrom folding a metadata refresh into every command, since mpm runs that as a separatesync(asked for since mpm’s early days). Outdated packages come from--json=v2; the installed and search listings are parsed from their plain-text columns.Note
The
>=6.0.0requirement is the release where ask mode became the default forbrew installandbrew upgrade, and where the--yesopt-out mpm relies on for unattended runs first shipped. It is also where Homebrew began rejecting third-party taps until trusted, so installing a fully-qualifieduser/tap/namepackage taps and trusts it first (seeHomebrew.trust_tap()).Caution
A pinned formula still appears in
mpm outdatedoutput, yetbrew upgradesilently skips it: mpm discards Homebrew’spinnedfields today.Initialize
cli_errorslist.- name: str = 'Homebrew Formulae'¶
Return package manager’s common name.
Default value is based on class name.
- homepage_url: str | None = 'https://brew.sh'¶
Home page of the project, only used in documentation for reference.
- logo: str | None = 'homebrew'¶
Slug of the brand mark standing for this manager in the documentation.
Names an SVG vendored under
docs/assets/managers/, whose provenance and license are recorded indocs/assets/managers/logos.yaml. Inlined at the top of the manager’s page bymeta_package_manager._docs; a manager leaving it unset keeps the page’s default package glyph.Several managers legitimately share one slug, either because they wrap the same upstream (
brewandcask) or because the tool has no mark of its own and its ecosystem’s stands in (aptunder Debian’s swirl,cargounder Rust’s gear). Documentation-only, likehomepage_url: no CLI output reads it.
- brewfile_entry_type: ClassVar[str | None] = 'brew'¶
Name of the Brewfile DSL entry type this manager maps to, or
Noneif the manager has no Brewfile equivalent.Set by the subset of managers Homebrew Bundle’s DSL covers, and consumed by
meta_package_manager.brewfilewhen rendering the output ofmpm dump --brewfile. Which manager maps to which entry is tabulated from these declarations in Snapshot and export, section “Brewfile”, where the export’s own quirks are documented too.
- cli_names: tuple[str, ...] = ('brew',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- post_args: tuple[str, ...] = ('--formula',)¶
Global list of options used before and after the invoked package manager CLI.
Automatically added to each
meta_package_manager.execution.CLIExecutor.run_cli()call.Essentially used to force silencing, low verbosity or no-color output.
- property orphans: Iterator[Package]¶
Fetch formulae installed as dependencies that nothing requires anymore.
--dry-runturnsautoremoveinto a read-only report of the would-be-removed formulae. Defined on the formula manager only: casks are never installed as dependencies, so they cannot be orphaned. Likeautoremoveitself, the call drops the--formulaselector the other formula operations force.$ brew autoremove --dry-run --quiet ==> Would autoremove 3 unneeded formulae: libpng little-cms2 openjpeg
- class meta_package_manager.managers.homebrew.Cask[source]¶
Bases:
HomebrewThe cask half of Homebrew: pre-built macOS applications.
Homebrew is the umbrella project behind the
brewCLI. mpm splits it into two managers over the same binary, this one for casks andBrewfor formulae; a forced--caskselector keeps every call on the cask side. Casks ship macOS.appbundles and.pkginstallers, so this manager is macOS-only.mpm drives
brewnon-interactively with the same environment pins asBrew(analytics and hints off,HOMEBREW_NO_AUTO_UPDATEso the metadata refresh stays a separatesync) and the same>=6.0.0floor (ask mode default, the--yesopt-out, and the tap-trust gate thatHomebrew.trust_tap()clears foruser/tap/namepackages).Note
Casks self-escalate: their artifacts (
.pkginstallers, kernel extensions) invokesudofrom insidebrew, so mpm never wraps a cask command in its ownsudo.Caution
Casks flagged
auto_updates trueorversion :latestupdate themselves, andbrew upgradeskips them unless--greedyis passed. mpm supplies--greedy(tooutdatedand toupgrade --all) unless auto-updating packages are being ignored.--greedyconflicts with--formula, so this handling is cask-only and cannot fold into the base shared withBrew.Initialize
cli_errorslist.- name: str = 'Homebrew Cask'¶
Return package manager’s common name.
Default value is based on class name.
- homepage_url: str | None = 'https://github.com/Homebrew/homebrew-cask'¶
Home page of the project, only used in documentation for reference.
- logo: str | None = 'homebrew'¶
Slug of the brand mark standing for this manager in the documentation.
Names an SVG vendored under
docs/assets/managers/, whose provenance and license are recorded indocs/assets/managers/logos.yaml. Inlined at the top of the manager’s page bymeta_package_manager._docs; a manager leaving it unset keeps the page’s default package glyph.Several managers legitimately share one slug, either because they wrap the same upstream (
brewandcask) or because the tool has no mark of its own and its ecosystem’s stands in (aptunder Debian’s swirl,cargounder Rust’s gear). Documentation-only, likehomepage_url: no CLI output reads it.
- brewfile_entry_type: ClassVar[str | None] = 'cask'¶
Name of the Brewfile DSL entry type this manager maps to, or
Noneif the manager has no Brewfile equivalent.Set by the subset of managers Homebrew Bundle’s DSL covers, and consumed by
meta_package_manager.brewfilewhen rendering the output ofmpm dump --brewfile. Which manager maps to which entry is tabulated from these declarations in Snapshot and export, section “Brewfile”, where the export’s own quirks are documented too.
- platforms: frozenset[Platform] | Group | Platform | Iterable[Platform | Group] = frozenset({Platform(id='macos', name='macOS')})¶
Casks are only available on macOS, not Linux or WSL.
- id: str = 'cask'¶
Package manager’s ID.
Derived by defaults from the lower-cased class name in which underscores
_are replaced by dashes-.This ID must be unique among all package manager definitions and lower-case, as they’re used as feature flags for the mpm CLI.
- virtual: bool = False¶
Should we expose the package manager to the user?
Virtual package manager are just skeleton classes used to factorize code among managers of the same family.
- internal_sudo: bool = True¶
Cask artifacts (
.pkginstallers, kernel extensions) runsudofrom insidebrew.
- cli_names: tuple[str, ...] = ('brew',)¶
List of CLI names the package manager is known as.
This list of recognized CLI names is ordered by priority. That way we can influence the search of the right binary.
- ..hint::
This was helpful in the case of the Python transition from 2.x to 3.x, where multiple versions of the same executable were named
pythonorpython3.
By default, this property’s value is derived from the manager’s ID (see the
MetaPackageManager.__init__method above).
- post_args: tuple[str, ...] = ('--cask',)¶
Global list of options used before and after the invoked package manager CLI.
Automatically added to each
meta_package_manager.execution.CLIExecutor.run_cli()call.Essentially used to force silencing, low verbosity or no-color output.
- upgrade_all_cli()[source]¶
Generates the CLI to upgrade all outdated packages.
Adds
--greedyto the sharedbrew upgradecommand when auto-updating packages are included, mirroringHomebrew.outdated(). Without it,brew upgradeskips casks flaggedauto_updates trueorversion :latest, sompm --include-auto-updates upgrade --allwould report them as outdated but never upgrade them.Note
This override is cask-only by necessity:
brew upgradedeclares--greedyand--formulamutually exclusive, whilebrew outdatedaccepts the pair. The conflict is intentional:--formulahas conflicted with--greedyever since the selector switch was added to brew upgrade in August 2020, and a request to tolerate--greedyas a no-op in formula-only contexts was declined as invalid usage. This method can therefore never fold back into the base class shared withbrew.A cask explicitly passed to
brew upgradeis always evaluated greedily, soHomebrew.upgrade_one_cli()needs no counterpart.