meta_package_manager.managers.homebrew module¶

class meta_package_manager.managers.homebrew.Homebrew[source]¶

Bases: PackageManager

Virtual base shared by the Brew and Cask managers.

Homebrew is the umbrella project behind the brew CLI. mpm exposes it as two managers over that single binary: Brew for formulae built from recipes, and Cask for pre-built macOS applications, each pinning its half with a --formula or --cask selector. This base holds the shared query, mutation and metadata logic; the concrete classes carry the manager-level narrative.

Initialize cli_errors list.

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 brew and cask CLIs now shares the same version.

2.7.0 was the first release to enforce the use of --cask option.

6.0.0 is the first release in which ask mode is the default for brew install and brew upgrade, and the first to ship the --yes opt-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 removed variable 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 --installed in 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.json on disk (the file Homebrew writes when installed under HOMEBREW_SBOM=1), the metadata’s external_sbom_path points at it so the SPDX renderer can splice the upstream document into the aggregate.

Casks reuse the same JSON payload through the casks array but do not get the SBOM-file treatment (Homebrew does not emit one for casks).

Return type:

Iterator[tuple[Package, PackageMetadata]]

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 pinned and pinned_version fields. The formula payload has always emitted them; the cask payload has emitted them since at least 5.1.15 but they only became meaningful with Homebrew 6.0.0, which added brew pin <cask> so casks can now actually be pinned. mpm discards both fields today: pinned packages still appear in mpm outdated output, and brew upgrade silently skips them at upgrade time.

Todo

Surface pin state, or let mpm outdated filter on it, by reading the pinned and pinned_version fields 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.

Return type:

Iterator[Package]

trust_tap(package_id)[source]¶

Trust the tap a third-party package_id belongs 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 install would otherwise abort with a tap trust is required warning when the snapshot pins a user/tap/name package.

Only fully-qualified package IDs (user/tap/name) need this step: core formulae and casks live on the trusted homebrew/core and homebrew/cask taps. The tap itself is registered first (idempotent if already tapped) so brew trust can resolve the formula or cask. The --formula and --cask flag is supplied by the subclass’s post_args.

$ brew tap gromgit/fuse
$ brew trust gromgit/fuse/ntfs-3g-mac --formula
Return type:

None

install(package_id, version=None)[source]¶

Install one package.

Tap-qualified IDs (user/tap/name) are routed through trust_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:

str

upgrade_all_cli()[source]¶

Generates the CLI to upgrade all outdated packages.

brew and cask share the same command, but cask overrides this method to append --greedy when 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!

--yes skips the interactive confirmation prompt that brew shows by default since ask mode became the default behaviour.

Return type:

tuple[str, ...]

upgrade_one_cli(package_id, version=None)[source]¶

Generates the CLI to upgrade the provided package.

brew and cask share 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!

--yes skips the interactive confirmation prompt that brew shows by default since ask mode became the default behaviour.

Return type:

tuple[str, ...]

remove(package_id)[source]¶

Removes a package.

$ brew uninstall bat
Uninstalling /usr/local/Cellar/bat/0.21.0... (14 files, 5MB)
Return type:

str

sync()[source]¶

Sync package metadata.

$ brew update --quiet
Already up-to-date.
Return type:

None

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:

None

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:

None

doctor_cli()[source]¶

Generates the CLI running the native self-diagnosis.

brew doctor exits non-zero when it finds anything to warn about, and prints its findings on <stderr>. Like autoremove and cleanup, it takes no --formula/--cask selector.

$ brew doctor
Your system is ready to brew.
Return type:

tuple[str, ...]

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 python or python3.

By default, this property’s value is derived from the manager’s ID (see the MetaPackageManager.__init__ method above).

id: str = 'homebrew'¶

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.

name: str = 'Homebrew'¶

Return package manager’s common name.

Default value is based on class name.

class meta_package_manager.managers.homebrew.Brew[source]¶

Bases: Homebrew

The formula half of Homebrew: command-line tools built from recipes.

Homebrew is the umbrella project behind the brew CLI. mpm splits it into two managers over the same binary, this one for formulae and Cask for macOS applications; a forced --formula selector keeps every call on the formula side. Homebrew core runs on macOS and on Linux and WSL.

mpm drives brew non-interactively and pins its environment: analytics and setup hints are silenced, and HOMEBREW_NO_AUTO_UPDATE keeps brew from folding a metadata refresh into every command, since mpm runs that as a separate sync (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.0 requirement is the release where ask mode became the default for brew install and brew upgrade, and where the --yes opt-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-qualified user/tap/name package taps and trusts it first (see Homebrew.trust_tap()).

Caution

A pinned formula still appears in mpm outdated output, yet brew upgrade silently skips it: mpm discards Homebrew’s pinned fields today.

Initialize cli_errors list.

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.

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 in docs/assets/managers/logos.yaml. Inlined at the top of the manager’s page by meta_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 (brew and cask) or because the tool has no mark of its own and its ecosystem’s stands in (apt under Debian’s swirl, cargo under Rust’s gear). Documentation-only, like homepage_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 None if the manager has no Brewfile equivalent.

Set by the subset of managers Homebrew Bundle’s DSL covers, and consumed by meta_package_manager.brewfile when rendering the output of mpm 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 python or python3.

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-run turns autoremove into 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. Like autoremove itself, the call drops the --formula selector the other formula operations force.

$ brew autoremove --dry-run --quiet
==> Would autoremove 3 unneeded formulae:
libpng
little-cms2
openjpeg
id: str = 'brew'¶

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.

class meta_package_manager.managers.homebrew.Cask[source]¶

Bases: Homebrew

The cask half of Homebrew: pre-built macOS applications.

Homebrew is the umbrella project behind the brew CLI. mpm splits it into two managers over the same binary, this one for casks and Brew for formulae; a forced --cask selector keeps every call on the cask side. Casks ship macOS .app bundles and .pkg installers, so this manager is macOS-only.

mpm drives brew non-interactively with the same environment pins as Brew (analytics and hints off, HOMEBREW_NO_AUTO_UPDATE so the metadata refresh stays a separate sync) and the same >=6.0.0 floor (ask mode default, the --yes opt-out, and the tap-trust gate that Homebrew.trust_tap() clears for user/tap/name packages).

Note

Casks self-escalate: their artifacts (.pkg installers, kernel extensions) invoke sudo from inside brew, so mpm never wraps a cask command in its own sudo.

Caution

Casks flagged auto_updates true or version :latest update themselves, and brew upgrade skips them unless --greedy is passed. mpm supplies --greedy (to outdated and to upgrade --all) unless auto-updating packages are being ignored. --greedy conflicts with --formula, so this handling is cask-only and cannot fold into the base shared with Brew.

Initialize cli_errors list.

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.

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 in docs/assets/managers/logos.yaml. Inlined at the top of the manager’s page by meta_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 (brew and cask) or because the tool has no mark of its own and its ecosystem’s stands in (apt under Debian’s swirl, cargo under Rust’s gear). Documentation-only, like homepage_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 None if the manager has no Brewfile equivalent.

Set by the subset of managers Homebrew Bundle’s DSL covers, and consumed by meta_package_manager.brewfile when rendering the output of mpm 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 (.pkg installers, kernel extensions) run sudo from inside brew.

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 python or python3.

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 --greedy to the shared brew upgrade command when auto-updating packages are included, mirroring Homebrew.outdated(). Without it, brew upgrade skips casks flagged auto_updates true or version :latest, so mpm --include-auto-updates upgrade --all would report them as outdated but never upgrade them.

Note

This override is cask-only by necessity: brew upgrade declares --greedy and --formula mutually exclusive, while brew outdated accepts the pair. The conflict is intentional: --formula has conflicted with --greedy ever since the selector switch was added to brew upgrade in August 2020, and a request to tolerate --greedy as a no-op in formula-only contexts was declined as invalid usage. This method can therefore never fold back into the base class shared with brew.

A cask explicitly passed to brew upgrade is always evaluated greedily, so Homebrew.upgrade_one_cli() needs no counterpart.

Return type:

tuple[str, ...]