salt.modules.brew

Homebrew for Mac OS X

Important

If you feel that Salt should be using this module to manage packages on a minion, and it is using a different module (or gives an error similar to 'pkg.install' is not available), see here.

salt.modules.brew.install(name=None, pkgs=None, taps=None, options=None, **kwargs)

Install the passed package(s) with brew install

name

The name of the formula to be installed. Note that this parameter is ignored if "pkgs" is passed.

CLI Example:

salt '*' pkg.install <package name>
taps

Unofficial GitHub repos to use when updating and installing formulas.

CLI Example:

salt '*' pkg.install <package name> tap='<tap>'
salt '*' pkg.install zlib taps='homebrew/dupes'
salt '*' pkg.install php54 taps='["josegonzalez/php", "homebrew/dupes"]'
options

Options to pass to brew. Only applies to initial install. Due to how brew works, modifying chosen options requires a full uninstall followed by a fresh install. Note that if "pkgs" is used, all options will be passed to all packages. Unrecognized options for a package will be silently ignored by brew.

CLI Example:

salt '*' pkg.install <package name> tap='<tap>'
salt '*' pkg.install php54 taps='["josegonzalez/php", "homebrew/dupes"]' options='["--with-fpm"]'

Multiple Package Installation Options:

pkgs

A list of formulas to install. Must be passed as a python list.

CLI Example:

salt '*' pkg.install pkgs='["foo","bar"]'

Returns a dict containing the new package names and versions:

{'<package>': {'old': '<old-version>',
               'new': '<new-version>'}}

CLI Example:

salt '*' pkg.install 'package package package'
salt.modules.brew.latest_version(*names, **kwargs)

Return the latest version of the named package available for upgrade or installation

Note that this currently not fully implemented but needs to return something to avoid a traceback when calling pkg.latest.

CLI Example:

salt '*' pkg.latest_version <package name>
salt '*' pkg.latest_version <package1> <package2> <package3>
salt.modules.brew.list_pkgs(versions_as_list=False, **kwargs)

List the packages currently installed in a dict:

{'<package_name>': '<version>'}

CLI Example:

salt '*' pkg.list_pkgs
salt.modules.brew.list_upgrades(refresh=True, **kwargs)

Check whether or not an upgrade is available for all packages

CLI Example:

salt '*' pkg.list_upgrades
salt.modules.brew.refresh_db()

Update the homebrew package repository.

CLI Example:

salt '*' pkg.refresh_db
salt.modules.brew.remove(name=None, pkgs=None, **kwargs)

Removes packages with brew uninstall.

name
The name of the package to be deleted.

Multiple Package Options:

pkgs
A list of packages to delete. Must be passed as a python list. The name parameter will be ignored if this option is passed.

New in version 0.16.0.

Returns a dict containing the changes.

CLI Example:

salt '*' pkg.remove <package name>
salt '*' pkg.remove <package1>,<package2>,<package3>
salt '*' pkg.remove pkgs='["foo", "bar"]'
salt.modules.brew.upgrade(refresh=True)

Upgrade outdated, unpinned brews.

refresh
Fetch the newest version of Homebrew and all formulae from GitHub before installing.

Return a dict containing the new package names and versions:

{'<package>': {'old': '<old-version>',
               'new': '<new-version>'}}

CLI Example:

salt '*' pkg.upgrade
salt.modules.brew.upgrade_available(pkg)

Check whether or not an upgrade is available for a given package

CLI Example:

salt '*' pkg.upgrade_available <package name>
salt.modules.brew.version(*names, **kwargs)

Returns a string representing the package version or an empty string if not installed. If more than one package name is specified, a dict of name/version pairs is returned.

CLI Example:

salt '*' pkg.version <package name>
salt '*' pkg.version <package1> <package2> <package3>