Skip to content

macOS bootstrap: Homebrew install aborts when sudo isn't pre-authorized #23

Description

@jdevera

Found during the fresh-macOS install documented in #20.

Problem

The Homebrew install step dies on a fresh machine:

=> Step 2: will install homebrew
==> Running in non-interactive mode because `$NONINTERACTIVE` is set.
==> Checking for `sudo` access (which may request your password)...
Need sudo access on macOS (e.g. the user jdevera needs to be an Administrator)!
✗  Step 2 fatal: could not install homebrew
chezmoi: .chezmoiscripts/010-install-homebrew.sh: exit status 1

We run the installer with NONINTERACTIVE=1 (home/.chezmoiscripts/run_once_after_010-install-homebrew.sh.tmpl), and in that mode Homebrew refuses to prompt for a password and bails. The only workaround was to manually run sudo ls first to prime the sudo timestamp.

Suggested direction

Before the non-interactive Homebrew install, prime sudo (e.g. sudo -v, or prompt the user once) so the cached credential is available, or detect the missing sudo timestamp and surface a clear instruction instead of a hard failure. Relates to the broader "surface deferred/failed steps" idea (see the run-warnings issue).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bootstrapFresh-machine bootstrap / first-run setup

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions