Install Homebrew as root for mass deployment on a Mac fleet — compatible with Intel and Apple Silicon, Jamf Pro, and direct CLI.
Based on kennyb-222/AutoBrew, rewritten for modern macOS.
Disclaimer: Running Homebrew as root is not officially supported. This script patches the root check at install time and is intended for managed/MDM environments only.
Direct CLI:
sudo /bin/bash /path/to/AutoBrew.sh
# or with a specific user:
sudo /bin/bash /path/to/AutoBrew.sh "username"Jamf Pro: deploy the script — the target user is read from parameter $3 (Jamf convention). If omitted, the script detects the currently logged-in console user automatically.
- Detects architecture → sets Homebrew prefix (
/opt/homebrewon Apple Silicon,/usr/localon Intel) - Validates the target user via
dscl - Downloads and patches Homebrew's install script (bypasses root check, disables interactive prompts via
NONINTERACTIVE=1) - Fixes ownership so the target user — not root — owns the Homebrew install
- Runs
brew update,brew cleanup, andbrew doctoras the target user; auto-applies any remediation commands suggested bydoctor
- macOS (Intel or Apple Silicon)
- Must be run as root (
sudo) - Target user must exist and be a valid local account