Guide

How to detect Homebrew across your fleet

Luke Hefson

Before you roll out Workbrew, it helps to know which machines in your fleet already have Homebrew installed. That inventory tells you where unmanaged brew usage already exists, so you can plan a rollout and set policy with the full picture rather than guessing.

This guide shows you how to find existing Homebrew installations across your fleet by pushing a small detection script through your MDM. You do not need Workbrew installed to run it.

The detection script

The script checks for the brew executable in the three standard Homebrew installation paths and exits accordingly:

#!/bin/bash
# Check for Homebrew in supported installation paths.
if [[ -x "/opt/homebrew/bin/brew" ]] ||
  [[ -x "/usr/local/bin/brew" ]] ||
  [[ -x "/home/linuxbrew/.linuxbrew/bin/brew" ]]
then
  echo "Homebrew is installed."
  exit 0
else
  echo "Homebrew is not installed."
  exit 1
fi

The three paths cover every standard install:

  • /opt/homebrew/bin/brew for Apple Silicon Macs
  • /usr/local/bin/brew for Intel Macs
  • /home/linuxbrew/.linuxbrew/bin/brew for Linux and Windows Subsystem for Linux

The script reports through both its output and its exit code: it prints a human-readable line and exits 0 when Homebrew is present, or exits 1 when it is not. Most MDM platforms key on the exit code, so you can build a Smart Group, report, or saved search from the result without parsing the output.

Run it across your fleet

The exact steps depend on your MDM, but the shape is the same everywhere:

  1. Add the script to your MDM as a script or extension attribute. Most platforms have a dedicated place for shell scripts that run on enrolled machines.
  2. Scope it to the machines you want to inventory, or to your whole fleet.
  3. Run it on demand, or on a schedule if you want the inventory to stay current as new machines enroll.
  4. Read the results from the script's exit code (0 means Homebrew is present) or its output.

For platform-specific steps, see your MDM's documentation. Workbrew integrates with the major platforms, including Iru and Jamf; the full list is on the integrations page.

After you have the inventory

The script tells you where Homebrew exists, but not what is installed, which versions are running, or whether anything is out of date. Answering those questions for every machine, continuously, is what Workbrew does once it is deployed.

After a Workbrew rollout, the Workbrew Console reports Homebrew presence, installed packages, and versions across every Device automatically, so you no longer need to run a detection script by hand. The one-time inventory you gather here is a good way to size that rollout and decide which machines to start with.

We use cookies to analyze traffic and improve your experience. You can accept all cookies or decline non-essential ones. Read our Privacy Policy for details.