Skip to content

Deploy Homebrew with Jamf Pro

Roll Homebrew out to your Macs with one Jamf Pro policy, let standard users install packages without admin rights, and scope package policy to your Jamf computer groups.

One policy installs Homebrew and EnterpriseBrew

Jamf Pro runs the install script as root, like any policy script. On each Mac the script installs Apple's Command Line Tools if they're missing, installs Homebrew from your EnterpriseBrew server (or keeps the copy that's already there), adds the EnterpriseBrew CLI and enrolls the Mac with your workspace's enrollment key. Nobody signs in to EnterpriseBrew on the Mac and nobody types a password.

Homebrew is set up for whoever is signed in at the screen, and the script works that out itself. A Mac sitting at the login window or still in Setup Assistant has nobody to set Homebrew up for, so the run stops with an error and Jamf's re-run on failure tries again at a later check-in. For a build machine that nobody signs in to, you name the account in the script.

A Mac that's already set up exits before anything is downloaded, so retries are harmless. From the first run on, the Mac checks in with EnterpriseBrew by itself at login and every 15 minutes, and its CLI keeps itself up to date.

Every brew install on an enrolled Mac is then decided on the server: your allow and block rules, license rules and minimum versions apply, the package is checked against the best available vulnerability data, and the install is logged under the person and the Mac.

Homebrew for standard users

Homebrew's own installer needs an administrator, and developers on standard accounts don't have one. That's why so many admins end up writing their own Jamf script for it. Here the steps that need root happen inside the Jamf policy, and the Homebrew prefix is handed to the person who will use it. They run brew install without sudo and without a local admin account.

If you'd rather the developer didn't own the prefix at all, turn on managed brew. The prefix then belongs to a local service account, and brew install still works without a password: the CLI passes the command to that account through a narrow sudoers rule, and the server still checks every package. Calling Homebrew directly to get around EnterpriseBrew doesn't get far, because the developer can't write to the prefix and Homebrew refuses before it changes anything.

Casks that ship a macOS installer package need real root. In managed mode those are left to IT unless you turn on privileged installs, which let the service account run the cask's installer. What may be installed is still your policy's decision.

Jamf computer groups become device groups

Give EnterpriseBrew a Jamf Pro API client with a single privilege, Read Computers, and it reads every Mac and the groups it belongs to every 15 minutes. Smart and static computer groups both come across. They show up as device groups you don't define or maintain, ready for allow and block rules, package sets, Brew configurations and remote commands.

Membership follows Jamf. When a Mac falls out of a smart group, the next sync takes it out of the device group, and the rules scoped to that group stop applying to it. If a sync fails, or Jamf suddenly reports no Macs at all, EnterpriseBrew keeps the last known groups, so a broken credential can't quietly lift a group-scoped block.

The daily check-in

A second, optional policy runs the check-in script once a day. It lists the Mac under MDM Devices even without the API connection, enrolls a Mac the install script couldn't, and installs a waiting CLI update on a Mac whose own updater is missing. It downloads nothing to run.

Before it runs the CLI as root, the script hashes the file with tools from /usr/bin and compares the result with the CLI versions your server has published. A file that matches none of them isn't run: the script reports it, and the Mac's page in the portal shows the finding. That's evidence the file was changed. It doesn't stop someone with admin rights from changing it.

Approved packages in Self Service

From the portal's Jamf page you can push a formula to Jamf Pro as a ready Self Service item. EnterpriseBrew uploads the icon and an install script and creates the policy; the API role then also needs the privileges to create scripts, policies and icons. Or export a ZIP with the script and the icon and upload it yourself. Either way the install runs through EnterpriseBrew, with the same policy and the same log.

Rollout in steps

  1. 1

    Copy the install script

    In the EnterpriseBrew portal, open Device Enrollment, choose Jamf Pro and activate it. The install script comes filled in for your workspace.

  2. 2

    Add it to Jamf Pro

    Under Settings > Computer management > Scripts, create a new script, paste it in and save it as EnterpriseBrew Install.

  3. 3

    Create the policy

    Trigger Recurring Check-in, Execution Frequency Once per computer, and Automatically re-run policy on failure with retries on the next recurring check-in. Add the script and scope the policy to a pilot group first.

  4. 4

    Connect the API

    Under Settings > API roles and clients (Jamf Pro 10.49 or later), create a role with Read Computers and an API client for it. Enter your Jamf Pro URL, the client ID and the secret on Device Enrollment, then save and sync.

  5. 5

    Check, then widen the scope

    Run sudo jamf policy on a test Mac. A few minutes later it's listed under Machines, and your computer groups appear under Device Groups.

What syncs from Jamf Pro

The API connection is read-only and runs every 15 minutes. Sync now on Device Enrollment runs it straight away.

WhatHow it's used
MacsEvery computer in the Jamf Pro inventory, with its hostname and serial number. The serial matches it to the Mac that enrolled.
Computer groupsSmart and static groups, kept as read-only device groups and updated in place, so the rules scoped to them keep working.
OwnerThe email of the user assigned to the Mac in Jamf. Installs from that Mac are recorded under it.
Written back to JamfNothing, unless you push a package to Self Service. That's the only step that creates anything in Jamf Pro.

Limits worth knowing

  • Someone has to be signed in when the policy runs, or the script has to name the account. Homebrew set up for root is of no use to the person who signs in later.
  • Group membership comes only from the API. Jamf keeps it on its own server, so neither script carries it.
  • Jamf groups are read-only in EnterpriseBrew. A manual device group with the same name keeps the Jamf group out, and the sync result names it.
  • Command Line Tools come from Apple's Software Update. A Mac that can't reach Apple's servers, or one where a profile holds updates back, needs them installed some other way first.
  • The Macs need to reach your EnterpriseBrew server and formulae.brew.sh, where Homebrew reads its package metadata.
  • The script carries your enrollment key, so keep it in Jamf Pro only. If it gets out, regenerate the key and replace the script; Macs that are already enrolled keep working.

Further reading