meta_package_manager.managers.homebrew — Meta Package Manager 2.4.1 documentation

# `meta_package_manager.managers.homebrew`

class `meta_package_manager.managers.homebrew.` `Homebrew`

  Bases: `meta_package_manager.base.PackageManager`

  `cli_path` = u'/usr/local/bin/brew'
  `platforms` = frozenset([u'macos'])
  `requirement` = u'>= 1.0.*'
  `id` = u'brew'
  `get_version`()

    Fetch version from `brew --version` output.

  `sync`()
  `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

  `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)
  `upgrade_all_cli`()

class `meta_package_manager.managers.homebrew.` `HomebrewCask`

  Bases: `meta_package_manager.managers.homebrew.Homebrew`

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

  `cli_args` = [u'cask']
  `requirement` = u'>= 1.1.*'
  `id` = u'cask'
  `name` = u'Homebrew Cask'
  `sync`()
  `outdated`

    Search for outdated packages among installed one.

    Cask doesn’t provides an `outdated` subcommand contrary to `brew`. We have no other alternative but to fetch the list of currently installed packages and inspect them one by one to search for outdated ones.

    Also, brew cask list is not reliable.

    Raw CLI output samples:

        $ brew cask info aerial
        aerial: 1.2beta5
        https://github.com/JohnCoates/Aerial
        /usr/local/Caskroom/aerial/1.2beta5 (18 files, 6.6M)
        From: https://github.com/(...)/blob/master/Casks/aerial.rb
        ==> Name
        Aerial Screensaver
        ==> Artifacts
        Aerial.saver (screen_saver)

        $ brew cask info firefox
        firefox: 50.0.1
        https://www.mozilla.org/firefox/
        /usr/local/Caskroom/firefox/49.0.1 (107 files, 185.3M)
        From: https://github.com/(...)/blob/master/Casks/firefox.rb
        ==> Name
        Mozilla Firefox
        ==> Artifacts
        Firefox.app (app)

        $ brew cask info virtualbox
        virtualbox: 5.1.10-112026
        https://www.virtualbox.org
        /usr/local/Caskroom/virtualbox/5.1.8-111374 (3 files, 88.8M)
        /usr/local/Caskroom/virtualbox/5.1.10-112026 (3 files, 89.3M)
        From: https://github.com/(...)/blob/master/Casks/virtualbox.rb
        ==> Name
        Oracle VirtualBox
        ==> Artifacts
        VirtualBox.pkg (pkg)

        $ brew cask info prey
        prey: 1.6.3
        https://preyproject.com/
        Not installed
        From: https://github.com/(...)/blob/master/Casks/prey.rb
        ==> Name
        Prey
        ==> Artifacts
        prey-mac-1.6.3-x86.pkg (pkg)
        ==> Caveats
        Prey requires your API key, found in the bottom-left corner of
        the Prey web account Settings page, to complete installation.
        The API key may be set as an environment variable as follows:

          API_KEY="abcdef123456" brew cask install prey

        $ brew cask info ubersicht
        ubersicht: 1.0.44
        http://tracesof.net/uebersicht/
        Not installed
        From: https://github.com/(...)/blob/master/Casks/ubersicht.rb
        ==> Name
        Übersicht
        ==> Artifacts
        Übersicht.app (app)

        $ brew cask info xld
        xld: 2016.10.07
        http://tmkk.undo.jp/xld/index_e.html
        /usr/local/Caskroom/xld/2016.10.07 (45 files, 221.6K)
        From: https://github.com/(...)/blob/master/Casks/xld.rb
        ==> Names
        X Lossless Decoder
        XLD
        ==> Artifacts
        XLD.app (app)

  `upgrade_cli`(package_id)

    Install a package.

    Todo

    Wait for https://github.com/caskroom/homebrew-cask/issues/22647 so we can force a cleanup in one go, as we do above with vanilla Homebrew.

  `upgrade_all_cli`()

    Cask has no way to upgrade all outdated packages.

    See: https://github.com/caskroom/homebrew-cask/issues/4678