Skip to content

brew

Install tools using Homebrew package manager on macOS and Linux.

Tools using the brew installation method automatically declare a dependency on brew, ensuring that if a tools/brew.tool.ts is configured in the project, Homebrew is provisioned first on virgin machines before formula installation.

Homebrew-installed tools are externally managed: Homebrew owns the files, and .bin() names the executables it provides so dotfiles can shim them (see .bin() runtime behavior).

import { defineTool } from "@alexgorbatchev/dotfiles";
export default defineTool((install) => install("brew", { formula: "ripgrep" }).bin("rg"));
ParameterDescription
formulaFormula or cask name (defaults to tool name)
caskSet true for cask installation
tapTap(s) to add before installing (brew tap <target>)
trustTap(s) or formula(s) to explicitly trust before tapping/installing (brew trust <target>). Set true to auto-trust configured tap(s). Defaults to false.
argsAdditional CLI flags passed directly to brew install (e.g. ['--HEAD'], ['--build-from-source'])
forcePass --force to brew install. Defaults to false.
serviceRun brew services <action> <formula> after install; true means start, a string is used as the action (e.g. 'start', 'run')
linkRun brew link after install: true links, { force?: boolean, overwrite?: boolean } adds the matching flags, false or omitted never links
versionArgsArguments for version check (e.g., ['--version']); without them the version comes from brew info
versionRegexRegex to extract version from output (string or RegExp)
install("brew", {
formula: "visual-studio-code",
cask: true,
});
install("brew", {
formula: "borders",
tap: "FelixKratz/formulae",
trust: true, // Automatically trusts "FelixKratz/formulae" before tapping
});
install("brew", {
formula: "redis",
service: "start",
link: { overwrite: true },
});
install("brew", {
formula: "custom-tool",
args: ["--build-from-source"],
});

An update check runs brew info --json=v2 <formula> (with --cask for a cask, and without it when the cask query fails). Homebrew’s own outdated verdict decides, since formula versions carry revision suffixes such as 1.2.3_1 that are not semantic versions. brew info describes a formula or cask that is not installed as not outdated, so a tool dotfiles installed whose package has no installed version fails the check, as does a query that fails or names no version. A tool dotfiles never installed is not checked; tool check reports it as not installed.

PlatformSupport
macOSFull (formulas + casks)
LinuxFormulas only
WindowsNot supported