Join our Newsletter — 33% off our NHI Course
Home› Guides› Homebrew Supply Chain Security Guide: Safe Installs, Trusted…
Guide Software & AI Supply Chain

Homebrew Supply Chain Security Guide: Safe Installs, Trusted Taps and Verified Bottles

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 19 November 2026 13 min read
On this page

Homebrew is the software supply chain for most developer Macs, so controlling where it comes from, which taps it trusts and whether its bottles are verified is a core part of protecting developer identities and secrets. A single brew install can pull code from the official core repository, a third-party tap or a cask that downloads a vendor application. The process runs with the developer's own privileges on a machine that typically holds cloud credentials, Git tokens, SSH keys and package registry tokens. If any link in that chain is compromised, the attacker inherits all of them.

This guide covers the Homebrew-specific controls that reduce that risk: installing from the genuine source and resisting fake install pages, governing taps, verifying build provenance with attestations, using the administrator policy variables Homebrew provides, managing the GitHub token Homebrew can use and building a managed baseline for a developer fleet. Broader workstation hardening, IDE extensions and dev containers are covered in our Developer Workstation and IDE Security Guide, which this page does not repeat.

This is an independent guide from NHI Mgmt Group, based on Homebrew's public documentation as of November 2026. It is not sponsored or reviewed by Homebrew. Product features change, so confirm settings against Homebrew's current documentation.

Key takeaways

  • Install Homebrew only from the instructions on brew.sh or the package on the Homebrew/brew GitHub releases page. Never copy an install command from a search advert, a forum post or a look-alike domain.
  • Fake Homebrew install pages are a malvertising lure aimed squarely at developers: the pasted command runs an infostealer instead of, or as well as, the real installer.
  • Tapping a repository adds code that runs with your privileges. Allow only taps you have reviewed, and use fully qualified names when a tap formula shares a name with a core formula.
  • Enable HOMEBREW_VERIFY_ATTESTATIONS to check build provenance for bottles that carry attestations, and understand what provenance does and does not prove.
  • Enforce policy fleet-wide with the system-wide environment file and the HOMEBREW_FORBIDDEN_* variables.
  • Treat HOMEBREW_GITHUB_API_TOKEN as a secret: give it the narrowest scope possible and keep it out of dotfiles that are synced or committed.

Why Homebrew is a supply chain and an identity risk

Package managers concentrate trust. When a developer installs a command-line tool through Homebrew, they are trusting the formula author, the maintainers who reviewed it, the build system that produced the bottle, the host that served the download and every dependency pulled in along the way. That trust is usually justified for the core repository, which has active review and automated builds, but it extends silently to taps and casks that have neither.

The prize for an attacker is the developer's identity footprint. A typical engineering laptop holds cloud provider credentials in configuration files, personal access tokens for source control, SSH private keys, package registry publishing tokens, browser sessions for SaaS consoles and, increasingly, API keys for AI services. Infostealers are built to harvest exactly those files. Code that runs during a package install, or a binary installed by one, can read them all. MITRE ATT&CK tracks this pattern as T1195.001 Compromise Software Dependencies and Development Tools, and the harvesting step as T1552.001 Credentials In Files.

That is why Homebrew hygiene belongs in an NHI programme. Every secret on a developer machine is a non-human credential waiting to be stolen, and the package manager is one of the main ways untrusted code arrives.

Installing from the genuine source

Homebrew's installation documentation points to brew.sh for supported install instructions. The one-line installer runs a script from https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh under /bin/bash, describes what it will do and asks for confirmation before it starts. It installs to /opt/homebrew on Apple Silicon and /home/linuxbrew/.linuxbrew on Linux. For managed Macs there is a .pkg installer on the latest Homebrew/brew GitHub release, which supports Apple Silicon and installs to /opt/homebrew.

For organisations, the safest pattern is to remove the copy-and-paste step entirely. Deploy Homebrew through your device management tool using the official package, pin the version you have tested, and give developers a documented internal page that links only to the official sources. When developers never need to search for "install Homebrew", the fake page has nobody to catch.

Homebrew's documentation also sets out an important trust boundary: it provides no security guarantees for installations where untrusted users have write access to the prefix, and this applies to package installs, including those deployed through device management. Keep the prefix owned by the intended account, and do not loosen permissions to make shared machines easier to use. Where several accounts share one installation, the documentation describes a dedicated managing account, with other accounts running commands as that owner through brew as-brew-user. It notes that running brew with sudo trusts the prefix owner to run code as root, and that HOMEBREW_NO_SUDO=1 disables Homebrew's own sudo calls.

Fake install pages and malvertising

Attackers buy search adverts and register look-alike domains that copy the Homebrew home page almost exactly. The page shows an install command that looks like the real one but fetches a script from an attacker-controlled host. A developer who pastes it into a terminal has run arbitrary code with their own privileges, and because the victim typed the command, many endpoint controls see nothing unusual. The technique combines MITRE ATT&CK T1583.008 Malvertising and T1608.006 SEO Poisoning to reach the victim, followed by credential theft from the workstation. Our Malvertising and SEO Poisoning Guide covers the delivery side in depth, and the Atomic macOS Stealer Guide covers a common macOS payload family.

Defences work at several layers:

  • Remove the need to search. Pre-install Homebrew on managed Macs and publish an internal install page that links only to brew.sh and the official GitHub release.
  • Teach one rule. The genuine install script is served from raw.githubusercontent.com/Homebrew/install. Any command that downloads from another host, decodes base64 or pipes to a second shell is suspect.
  • Filter at the network. Block newly registered and look-alike domains in DNS filtering, and consider blocking search adverts on corporate browsers.
  • Detect the behaviour. Alert when a terminal process spawns curl to an unfamiliar domain followed by script execution, or when an unsigned binary reads browser profile and keychain locations shortly after a terminal paste.
  • Assume compromise quickly. If a developer reports having pasted a command from an unofficial page, isolate the machine and rotate every credential it held, starting with cloud and source control tokens.

Governing taps

Homebrew's taps documentation explains that brew tap adds repositories that Homebrew can use for formulae, casks and external commands. The one-argument form, brew tap user/repo, clones https://github.com/<user>/homebrew-<repository>, and the two-argument form clones from any Git URL. Taps are updated during brew update, so a tap you reviewed once can change later.

The documentation is explicit that code in a tap runs with your user's privileges and asks users to read its tap trust guidance before using a non-official tap. Tapping a repository does not grant whole-tap trust: installing with a fully qualified name such as brew install username/repository/vim trusts that individual formula. Name collisions are handled conservatively. A plain brew install vim gets the core version even if a tap has a formula of the same name, and dependencies of core formulae cannot be swapped for tap formulae.

For an organisation, a sound tap policy looks like this:

  1. Keep a short approved list of taps, each with an owner who reviews changes. Vendor taps for tools you already license are reasonable candidates; personal taps from unknown accounts are not.
  2. Use fully qualified names in scripts and Brewfiles so the intended source is always explicit.
  3. Block unapproved taps with HOMEBREW_FORBIDDEN_TAPS where you know specific risky taps, and audit installed taps with brew tap, which lists all installed taps when given no arguments.
  4. Host your own internal tap for in-house tools, protected by branch rules and signed commits, rather than distributing scripts by chat or wiki.
  5. Watch for tap repositories that change owner or are deleted and recreated, which can let a new party take over a trusted name.

Bottles, attestations and build provenance

A bottle is a pre-built binary package. Most users install bottles rather than building from source, so the integrity of the bottle build matters. According to Trail of Bits' May 2024 write-up of the work, homebrew-core began cryptographically attesting all bottles built in the official Homebrew CI using GitHub's artifact attestations feature. The attestation records metadata such as the Git commit and GitHub Actions run that produced the bottle, and the authors described it as compatible with SLSA Build Level 2. At the time it was a public beta.

The Homebrew manpage now documents HOMEBREW_VERIFY_ATTESTATIONS: if set, Homebrew uses the gh tool to verify cryptographic attestations of build provenance for bottles from homebrew/core or supported third-party taps. Verification needs authenticated GitHub API access, which ties this control to the token discussed below.

Be clear about what provenance proves. It shows that a bottle was built by the expected CI workflow from a specific commit. The Trail of Bits write-up notes that it does not protect against software that is malicious or compromised at the source, does not replace defences against downgrade or confusion attacks, and does not stop a fully malicious maintainer, although it makes such actions publicly auditable. Provenance closes the gap between reviewed source and shipped binary; source review and tap governance still have to cover the rest. Our Sigstore Guide and SLSA and Build Provenance Guide explain the underlying model.

Casks and downloaded applications

Casks install macOS applications, fonts and plugins, usually by downloading a vendor's own installer or disk image. The cask definition is reviewed, but the payload comes from the vendor's servers. That makes casks only as trustworthy as the vendor's distribution, and it means a cask can install software that needs elevated privileges or system extensions. Use HOMEBREW_FORBIDDEN_CASKS to block applications your organisation does not permit, rely on macOS code signing and notarisation checks rather than bypassing them, and avoid cask options that strip quarantine attributes on managed machines. HOMEBREW_CASK_OPTS appends options to all cask commands, so check it is not set in user environments to weaken these defaults.

Administrator policy controls

Homebrew reads environment variables from a system-wide file, /etc/homebrew/brew.env, which is loaded before prefix-specific and user-specific files. If HOMEBREW_SYSTEM_ENV_TAKES_PRIORITY is set in that file, it is loaded last and overrides prefix and user settings. That gives administrators a central place to set policy that developers cannot casually undo. Useful settings documented in the manpage include:

VariableDocumented effectSecurity use
HOMEBREW_VERIFY_ATTESTATIONSVerify build provenance attestations with ghCheck bottle provenance where attestations exist
HOMEBREW_FORBIDDEN_FORMULAERefuse a formula or cask if it or a dependency is listedBlock tools banned by policy
HOMEBREW_FORBIDDEN_CASKSRefuse a cask if it or a dependency is listedBlock unapproved applications
HOMEBREW_FORBIDDEN_TAPSRefuse a formula if it or a dependency is in a listed tapBlock known risky taps
HOMEBREW_FORBIDDEN_LICENSESRefuse formulae with listed SPDX licencesLicence compliance
HOMEBREW_FORBIDDEN_OWNERNames who set the forbidden listsTell developers whom to contact
HOMEBREW_NO_INSECURE_REDIRECTForbid redirects from HTTPS to HTTPPrevent downgrade of downloads
HOMEBREW_ARTIFACT_DOMAIN, HOMEBREW_BOTTLE_DOMAINPrefix download URLs or set a bottle mirrorRoute downloads through an internal, scanned mirror

The manpage notes that HOMEBREW_NO_INSECURE_REDIRECT may break some downloads from SourceForge, GNU or GNOME, so test before enforcing. If you route downloads through an internal mirror, the mirror becomes part of your supply chain and needs its own access control and integrity checks.

The Homebrew GitHub token

The manpage describes HOMEBREW_GITHUB_API_TOKEN as a personal access token for the GitHub API, used for features such as brew search, and attestation verification needs authenticated GitHub access too. Developers often create a broad classic token for this, paste it into a shell profile and forget it. That token then sits in a plain text file that infostealers target and that sometimes gets committed with a dotfiles repository.

  • Use a fine-grained token with no repository write access, or no scopes beyond public read, and set an expiry date.
  • Keep it in the macOS keychain or a secrets manager and load it at shell start, rather than writing the literal value into a dotfile.
  • Scan dotfiles repositories for GitHub token formats, and enable push protection where your source control supports it.
  • Include the token in your NHI inventory for developer machines and in offboarding checklists.

Building a managed developer baseline

Brewfiles make Homebrew state reproducible. The manpage describes brew bundle installing and upgrading dependencies from a Brewfile, brew bundle dump writing the installed state to a Brewfile that can be kept in version control, and $HOMEBREW_BUNDLE_FILE setting its location. Keep a reviewed, version-controlled Brewfile for each developer role, using fully qualified names for any tap formulae, and require pull request review for changes. Combine that with the system-wide environment file for policy, device management for installation and endpoint detection for behaviour, and you have a baseline that is both easy for developers and auditable by security.

Common failure patterns

  • Install command copied from a search result. A look-alike page serves a malicious script and the developer runs it willingly.
  • Taps added freely. Any developer can tap any repository, and those taps update silently with every brew update.
  • Ambiguous formula names. Scripts rely on short names, so the intended source is unclear when taps change.
  • Provenance treated as a safety guarantee. Attestations are read as proof that code is benign, when they only prove where and how it was built.
  • Broad GitHub token in a dotfile. A classic token with repository write access is stored in plain text and stolen by an infostealer.
  • Shared, writable prefix. Multiple users can write to the Homebrew prefix, which removes Homebrew's own security assumptions.
  • Policy set per user. Forbidden lists live in user profiles that developers can edit, rather than in the system-wide file.

Practitioner checklist

  • Deploy Homebrew from the official package through device management and publish an internal install page.
  • Brief developers that the genuine script comes only from raw.githubusercontent.com/Homebrew/install.
  • Maintain an approved tap list with owners and use fully qualified names in scripts and Brewfiles.
  • Set HOMEBREW_VERIFY_ATTESTATIONS and the forbidden lists in /etc/homebrew/brew.env, with HOMEBREW_SYSTEM_ENV_TAKES_PRIORITY where appropriate.
  • Set HOMEBREW_FORBIDDEN_OWNER so developers know who owns the policy.
  • Keep the Homebrew prefix owned by a single intended account with no untrusted write access.
  • Replace broad Homebrew GitHub tokens with fine-grained, expiring tokens stored in the keychain.
  • Detect terminal-driven downloads from unfamiliar hosts followed by credential file access.
  • Rotate every credential on a developer machine after a suspected fake install.

Standards and references

Related NHI Mgmt Group resources: Developer Workstation and IDE Security Guide · Malvertising and SEO Poisoning Guide · Sigstore Guide · Compromised Developer Workstation Playbook

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.