Repository navigation
Support Homebrew without sudo access - #24062
Merged
Merged
Conversation
MikeMcQuaid
force-pushed
the
homebrew-user-access
branch
from
September 21, 2026 20:52
141cbc1 to
1312ada
Compare
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR adds support for managing Homebrew installations without sudo, including conservative sudo detection, optional filesystem elevation, dedicated-user dispatch, ownership handling and documentation updates.
Changes:
- Adds
HOMEBREW_NO_SUDOdetection and optional elevation. - Adds
brew as-brew-userand improves console-user dispatch. - Updates cask/package ownership, privileged-artifact handling, tests, docs and completions.
| File | Description |
|---|---|
| package/​scripts/​postinstall | Updated as part of this pull request. |
| manpages/​brew.1 | Updated as part of this pull request. |
| Library/​Homebrew/​utils/​as_user.sh | Updated as part of this pull request. |
| Library/​Homebrew/​test/​test_bot/​test_cleanup_spec.rb | Updated as part of this pull request. |
| Library/​Homebrew/​test/​system_command_sudo_spec.rb | Updated as part of this pull request. |
| Library/​Homebrew/​test/​startup/​sudo_spec.rb | Updated as part of this pull request. |
| Library/​Homebrew/​test/​pkg_postinstall_spec.rb | Updated as part of this pull request. |
| Library/​Homebrew/​test/​install_steps_spec.rb | Updated as part of this pull request. |
| Library/​Homebrew/​test/​cmd/​as-console-user_spec.rb | Updated as part of this pull request. |
| Library/​Homebrew/​test/​cmd/​as-brew-user_spec.rb | Updated as part of this pull request. |
| Library/​Homebrew/​test/​cask/​quarantine_spec.rb | Updated as part of this pull request. |
| Library/​Homebrew/​test/​cask/​installer_no_sudo_spec.rb | Updated as part of this pull request. |
| Library/​Homebrew/​test/​cask/​dsl/​shared_examples/​staged.rb | Updated as part of this pull request. |
| Library/​Homebrew/​test/​cask/​dsl/​preflight_spec.rb | Updated as part of this pull request. |
| Library/​Homebrew/​test/​cask/​caskroom_spec.rb | Updated as part of this pull request. |
| Library/​Homebrew/​test/​cask/​artifact/​app_spec.rb | Updated as part of this pull request. |
| Library/​Homebrew/​test_bot/​test_cleanup.rb | Updated as part of this pull request. |
| Library/​Homebrew/​system_command.rb | Updated as part of this pull request. |
| Library/​Homebrew/​sorbet/​rbi/​dsl/​homebrew/​env_config.rbi | Updated as part of this pull request. |
| Library/​Homebrew/​sorbet/​rbi/​dsl/​homebrew/​cmd/​as_brew_user.rbi | Updated as part of this pull request. |
| Library/​Homebrew/​install_steps.rb | Updated as part of this pull request. |
| Library/​Homebrew/​extend/​os/​mac/​cask/​quarantine.rb | Updated as part of this pull request. |
| Library/​Homebrew/​extend/​os/​mac/​cask/​artifact/​symlinked.rb | Updated as part of this pull request. |
| Library/​Homebrew/​env_config.rb | Updated as part of this pull request. |
| Library/​Homebrew/​dev-cmd/​vendor-gems.rb | Updated as part of this pull request. |
| Library/​Homebrew/​dev-cmd/​bottle.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cmd/​as-console-user.sh | Updated as part of this pull request. |
| Library/​Homebrew/​cmd/​as-console-user.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cmd/​as-brew-user.sh | Updated as part of this pull request. |
| Library/​Homebrew/​cmd/​as-brew-user.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​utils.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​staged.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​quarantine.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​installer.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​caskroom.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​artifact/​symlinked.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​artifact/​relocated.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​artifact/​pkg.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​artifact/​moved.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​artifact/​installer.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​artifact/​binary.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​artifact/​appimage.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​artifact/​app.rb | Updated as part of this pull request. |
| Library/​Homebrew/​cask/​artifact/​abstract_artifact.rb | Updated as part of this pull request. |
| Library/​Homebrew/​brew.sh | Updated as part of this pull request. |
| docs/​Support-Tiers.md | Updated as part of this pull request. |
| docs/​Manpage.md | Updated as part of this pull request. |
| docs/​Installation.md | Updated as part of this pull request. |
| docs/​Homebrew-Security-and-Supply-Chain.md | Updated as part of this pull request. |
| docs/​Homebrew-on-Linux.md | Updated as part of this pull request. |
| docs/​FAQ.md | Updated as part of this pull request. |
| completions/​zsh/​_brew | Updated as part of this pull request. |
| completions/​internal_commands_list.txt | Updated as part of this pull request. |
| completions/​fish/​brew.fish | Updated as part of this pull request. |
| completions/​bash/​brew | Updated as part of this pull request. |
Files not reviewed (2)
- Library/Homebrew/sorbet/rbi/dsl/homebrew/cmd/as_brew_user.rbi: File type not supported
- Library/Homebrew/sorbet/rbi/dsl/homebrew/env_config.rbi: File type not supported
đź’ˇ Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
MikeMcQuaid
force-pushed
the
homebrew-user-access
branch
5 times, most recently
from
September 22, 2026 13:44
5b3d7a5 to
a5f4778
Compare
MikeMcQuaid
force-pushed
the
homebrew-user-access
branch
from
September 22, 2026 13:53
a5f4778 to
3dece9e
Compare
p-linnane
approved these changes
Sep 22, 2026
MikeMcQuaid
force-pushed
the
homebrew-user-access
branch
from
September 23, 2026 03:38
3dece9e to
1e7795f
Compare
- Detect unavailable sudo conservatively and honour `HOMEBREW_NO_SUDO`. - Retry optional filesystem operations only when elevation is needed. - Reject casks requiring privileged installers before installation. - Protect non-admin `staff` installations from other users' writes. - Preserve stricter umasks in Homebrew and installer subprocesses. - Let root switch users without sudo and preserve command failures. - Skip optional system service probes when sudo is disabled. - Document sudo-free operation and its limits.
MikeMcQuaid
force-pushed
the
homebrew-user-access
branch
from
September 23, 2026 14:45
1e7795f to
bbfa5f8
Compare
4 tasks done
4 tasks done
5 of 8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

HOMEBREW_NO_SUDO.brew benchmarkresults.brewcommands to reproduce the bug?brew lgtm(style, typechecking and tests) locally?Codex with GPT 6 Astra at Extra High effort, with local review and testing.