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/brewfor Apple Silicon Macs/usr/local/bin/brewfor Intel Macs/home/linuxbrew/.linuxbrew/bin/brewfor 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:
- 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.
- Scope it to the machines you want to inventory, or to your whole fleet.
- Run it on demand, or on a schedule if you want the inventory to stay current as new machines enroll.
- Read the results from the script's exit code (
0means 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.
Related docs
- Getting started with Workbrew — turn this inventory into a managed fleet with continuous visibility into packages and versions.
- Deployment guides — deploy Workbrew through the same MDM you used to run the detection script.
- How to manually install Workbrew on a Device — install Workbrew on a single machine to try it first.
- Frequently asked questions — common questions about how Workbrew works on your Devices.