Skip to content

Allow installation without sudo access - #1148

Merged
MikeMcQuaid merged 1 commit into
mainfrom
homebrew-user-access
Sep 23, 2026
Merged

MikeMcQuaid merged 1 commit into
mainfrom
homebrew-user-access

Conversation

@MikeMcQuaid

@MikeMcQuaid MikeMcQuaid commented Sep 21, 2026 •

Copy link
Copy Markdown
Member
  • Use writable prefixes and the installing account's group without requiring administrator membership.
  • Honour HOMEBREW_NO_SUDO and detect known privilege failures.
  • Try filesystem operations before requesting elevation.
  • Skip Command Line Tools without sudo and make their installation failures non-fatal when a usable Git is available.
  • Validate Git before downloading Homebrew, accepting Xcode's Git.
  • Cover permissions and optional tools with Ruby tests and verify installation and package use as a real non-admin account in CI.
  • Use the test account's login environment to avoid inheriting the runner's inaccessible working directory.

Copilot AI lite review requested due to automatic review settings September 21, 2026 21:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

馃煛 Changes recommended

There are a couple of concrete installer UX/logic issues in the changed install.sh block that should be addressed before approving.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

This PR updates the installer to better support running without administrator membership by preferring writable prefixes and reducing reliance on sudo, while adding documentation and automated coverage for non-admin/provisioned-prefix scenarios.

Changes:

  • Adjusts macOS group selection and installer behavior to allow installs into writable/provisioned prefixes without requiring admin membership.
  • Adds conservative sudo capability detection and makes execute_sudo attempt operations without elevation before retrying with sudo when necessary.
  • Adds permission-focused tests and CI coverage, plus README guidance for no-sudo installs.
File Description
install.sh Implements sudo-less flow, conservative sudo failure detection, and conditional /etc/paths.d creation.
tests/鈥媡est_install.py Adds unit tests covering sudo detection, probing behavior, and group selection for non-admin installs.
README.md Documents no-sudo installation expectations and HOMEBREW_NO_SUDO.
.github/鈥媤orkflows/鈥媡ests.yml Runs the new installer permission tests in CI and adds a provisioned-prefix no-sudo install scenario.

馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread install.sh
Comment thread install.sh Outdated
@MikeMcQuaid
MikeMcQuaid force-pushed the homebrew-user-access branch 7 times, most recently from e557d8c to 7e34898 Compare September 22, 2026 14:32
Comment thread install.sh
- Allow writable prefixes without administrator membership.
- Keep macOS's admin group for members and use the primary group
  otherwise, allowing group changes without elevation.
- Remove group and other write access when falling back to `staff`,
  including existing files, and restrict the umask for new files.
- Honour `HOMEBREW_NO_SUDO` and detect known privilege failures.
- Probe sudo without refreshing cached credentials.
- Try filesystem operations before requesting elevation.
- Skip Command Line Tools without sudo and make their installation
  failures non-fatal when a usable Git is available.
- Validate Git before downloading Homebrew, accepting PATH and Xcode
  installations without invoking Apple's developer-tool stubs.
- Recommend the macOS package for MDM and identify the release
  requirement for installation without Git or developer tools.
- Cover permissions and optional tools with Ruby tests and verify
  installation and package use as a real non-admin account in CI.
- Use the test account's login environment to avoid inheriting the
  runner's inaccessible working directory.
@MikeMcQuaid
MikeMcQuaid merged commit e53db71 into main Sep 23, 2026
8 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the homebrew-user-access branch September 23, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants