Repository navigation
fix(install): source brew env so non-interactive update finds cargo - #1270
Merged
Merged
Conversation
`airc update` spawns install.sh in a non-interactive shell that does NOT inherit /opt/homebrew/bin on PATH (the `brew shellenv` line lives in an interactive-only ~/.zprofile). On macOS this made detect_pkgmgr report "brew-missing" and the build die at the "cargo is required" probe — even though brew AND cargo were installed at /opt/homebrew/bin. Self-update (airc-daemon auto_update -> airc update --auto -> install.sh) inherits the same blind spot, so the very mechanism meant to keep nodes current could not rebuild on a stock macOS box. Add ensure_brew_on_path(): on Darwin, if brew isn't already reachable, source `brew shellenv` from the well-known prefixes (/opt/homebrew/bin, /usr/local/bin) so brew + cargo land on PATH for the rest of the script. Called at the top of ensure_prereqs and (belt-and-suspenders, for the AIRC_SKIP_PREREQS path) at the top of _install_airc_binary. Idempotent, no-op off macOS / when brew already on PATH / when brew is genuinely absent (the existing installer path still handles that case). Proven: install.sh now builds + installs in a scrubbed PATH=/usr/bin:/bin:/usr/sbin:/sbin env where it previously bailed. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
Problem (a real self-update reliability bug)
airc updatespawnsinstall.shin a non-interactive shell. On macOS that shell does NOT have/opt/homebrew/binon PATH — thebrew shellenvline that adds it lives in an interactive-only~/.zprofile. Sodetect_pkgmgrreportedbrew-missingand the build died at thecargo is required to build aircprobe, even though brew AND cargo were installed at/opt/homebrew/bin.Caught live on M5:
airc update→This is load-bearing for the daemon self-update mechanism (#1268):
auto_update→airc update --auto→install.shinherits the same non-interactive blind spot, so the mechanism meant to keep nodes current couldn't rebuild on a stock macOS box. Reliability foundation for the mesh.Fix
ensure_brew_on_path(): on Darwin, ifbrewisn't already reachable,eval "$(<prefix>/brew shellenv)"from the well-known prefixes (/opt/homebrew/bin,/usr/local/bin) so brew + cargo land on PATH for the rest of the script. Called at the top ofensure_prereqsand (belt-and-suspenders, for theAIRC_SKIP_PREREQSpath) at the top of_install_airc_binary. Idempotent; no-op off macOS, when brew is already on PATH, or when brew is genuinely absent (existing installer path still handles that).Proof
bash -nclean. Built + installed in a scrubbedenv -i PATH=/usr/bin:/bin:/usr/sbin:/sbinwhere it previously bailed:🤖 Generated with Claude Code