meta_package_manager.managers.homebrew

class meta_package_manager.managers.homebrew.Homebrew[source]

Bases: meta_package_manager.base.PackageManager

Virutal package manager shared by brew and cask CLI defined below.

Homebrew is the umbrella project providing both brew and brew cask commands.

platforms = frozenset({'macos'})
requirement = '2.2.9'
cli_name = None
get_version()[source]

Fetch version from brew --version output.

Raw CLI output samples:

$ 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)
sync()[source]

brew and cask share the same command.

installed

Fetch installed packages from brew list output.

Note

This method is shared by brew and cask, only that the latter adds its cask subcommand to the CLI call.

Raw CLI output samples:

$ brew list --versions
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 cask list --versions
aerial 1.2beta5
android-file-transfer latest
audacity (!) 2.1.2
bitbar 1.9.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
search(query, extended, exact)[source]

Fetch matching packages from brew search output.

$ brew search sed
==> Formulae
gnu-sed ✔                    libxdg-basedir               minised
==> Casks
eclipse-dsl                       marsedit
focused                           physicseditor
google-adwords-editor             prefs-editor
licensed                          subclassed-mnemosyne
$ brew search --formulae sed
==> Formulae
gnu-sed ✔                    libxdg-basedir               minised
$ brew search --cask sed
==> Casks
eclipse-dsl                       marsedit
focused                           physicseditor
google-adwords-editor             prefs-editor
licensed                          subclassed-mnemosyne
$ brew search --formulae python
==> Formulae
app-engine-python   boost-python3   python ✔          python-yq
boost-python        gst-python      python-markdown   python@3.8 ✔
$ brew search --formulae "/^ssed$/"
==> Formulae
ssed
$ brew search --formulae "/^sed$/"
No formula or cask found for "/^sed$/".
Closed pull requests:
Merge ba7a794 (https://github.com/Homebrew/linuxbrew-core/pull/198)
R: disable Tcl (https://github.com/Homebrew/homebrew-core/pull/521)
(...)

More doc at: https://docs.brew.sh/Manpage#search-texttext

outdated

Fetch outdated packages from brew outdated output.

Raw CLI output samples:

$ brew outdated --json=v1
[
  {
    "name": "cassandra",
    "installed_versions": [
      "3.5"
    ],
    "current_version": "3.7"
  },
  {
    "name": "vim",
    "installed_versions": [
      "7.4.1967"
    ],
    "current_version": "7.4.1993"
  },
  {
    "name": "youtube-dl",
    "installed_versions": [
      "2016.07.06"
    ],
    "current_version": "2016.07.09.1"
  }
]
upgrade_cli(package_id=None)[source]

Runs:

$ brew upgrade
==> 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
upgrade_all_cli()[source]

Return a bash-compatible full-CLI to upgrade all packages.

cleanup()[source]

Scrub the cache, including downloads for even the latest versions.

Note downloads for any installed formulae or casks will still not be deleted.

$ brew cleanup -s
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 at: https://docs.brew.sh/Manpage#cleanup-options-formulacask

class meta_package_manager.managers.homebrew.Brew[source]

Bases: meta_package_manager.managers.homebrew.Homebrew

name = 'Homebrew Formulae'
cli_name = 'brew'
search_cli

Returns the CLI to run search on Homebrew formulae.

Raw CLI output samples:

$ brew search --formulae sed
==> Formulae
gnu-sed ✔                    libxdg-basedir               minised
class meta_package_manager.managers.homebrew.Cask[source]

Bases: meta_package_manager.managers.homebrew.Homebrew

Cask is now part of Homebrew’s core and extend it.

name = 'Homebrew Cask'
cli_name = 'brew'
global_args = ['cask']
search_cli

Returns the CLI to run search on Homebrew casks.

Raw CLI output samples:

$ brew search --cask sed
==> Casks
eclipse-dsl                       marsedit
focused                           physicseditor
google-adwords-editor             prefs-editor
licensed                          subclassed-mnemosyne
outdated

Search for outdated packages among installed one.

Raw CLI output samples:

$ brew cask outdated
google-play-music-desktop-player (4.4.0) != 4.4.1
$ brew cask outdated --verbose
java (9.0.1,11) != 10,46:76eac37278c24557a3c4199677f19b62
prey (1.7.2) != 1.7.3
qlvideo (1.90) != 1.91
virtualbox (5.2.4-119785) != 5.2.8,121009
$ brew cask outdated --greedy --verbose
android-file-transfer (latest) != latest
atom (1.19.3) != 1.19.4
dropbox (latest) != latest
google-chrome (latest) != latest
google-drive (latest) != latest
google-play-music-desktop-player (4.4.0) != 4.4.1
karabiner-elements (0.90.92) != 0.91.13
osxfuse (3.5.6) != 3.6.3
qlimagesize (latest) != latest
qlrest (latest) != latest
quicklook-json (latest) != latest
steam (latest) != latest
upgrade_cli(package_id=None)[source]

Install a package.