# homebrew/install — AlpLab Radar Static Code Audit

- Ring: `adopt`
- Category: `dev`
- Overall score: `4.5/5`
- Implementation check: `verified`
- Maturity: `active`
- Audited commit: `c9c975046f78` (read-only; nothing from the repository was executed)
- Reviewed at: 2026-11-30T12:43:25Z
- Repository: https://github.com/homebrew/install
- Radar entry: https://radar.alplab.co/#repo/homebrew/install
- License: `BSD-2-Clause`
- CI workflows: `.github/workflows`
- Tags: `homebrew`, `installer`, `shell`, `macos`, `linux`, `package-manager`

## Summary

Official Homebrew (un)installer shell scripts: validates prefix/OS, handles sudo conservatively, optionally installs Xcode CLT, clones Homebrew/brew via git and checks out the latest stable tag.

## Implementation Check

README claims (install/uninstall, NONINTERACTIVE, --path, git mirrors, HOMEBREW_NO_SUDO, /etc/paths.d entry) are all implemented in install.sh and uninstall.sh; nothing is a stub.

## When to Use

The canonical way to install or uninstall Homebrew on Apple Silicon Macs or Linux. For MDM/automation where reproducibility matters, prefer the documented .pkg release or a pinned commit over piping HEAD.

## Sub-scores

| Dimension | Score |
|---|---|
| quality | 5.0/5 |
| usability | 5.0/5 |
| reliability | 3.0/5 |
| security | 4.5/5 |
| integration | 5.0/5 |

## Code Evidence

install.sh implements the full flow with careful privilege handling: kill-switch /etc/homebrew/brew.no_install, prefix validation (install.sh ~270-300), sudo detection via `sudo -n -k -l` with credential invalidation trap and HOMEBREW_NO_SUDO fallback (have_sudo_access, ~390-445), analytics disabled for the install run, git clone + checkout of latest tag as stable. tests/test_install.rb has ~30 minitest cases stubbing sudo/git/softwareupdate to cover sudo error classification, CLT failure paths, non-admin prefix permissions, and uninstall preview. .github/workflows/tests.yml runs syntax checks (bash 3.x -n), the Ruby suite, and real end-to-end install -> brew install ack -> uninstall on macOS, Ubuntu and Windows/WSL, including a non-admin user into a provisioned prefix and custom prefixes.

## Issues Found

None recorded.

## Key Risks

Nothing was executed here; reliability judgement rests on the test suite and CI definition, not observed runs. The distribution model is inherently curl | bash from GitHub HEAD — integrity rests on TLS and the org, not pinning or signatures. uninstall.sh fetches brew's .gitignore from raw.githubusercontent.com when the local one is missing (uninstall.sh:350) and derives deletion paths from it; mitigated by dry-run, marker checks and the /usr/local skip, but it is network-influenced deletion. Windows support is WSL-only (CI only).

## Reviewed Files

- `README.md`
- `install.sh`
- `uninstall.sh`
- `tests/test_install.rb`
- `.github/workflows/tests.yml`
