ci: install pkg to user home on runners without passwordless sudo#6142
Merged
Conversation
`sudo installer -pkg ... -target /` requires passwordless sudo, which is
the default on GitHub-hosted macOS runners but not on the self-hosted
ones in the MeshInspector fleet, where the runner service runs as a
non-admin user. That made every `test-distribution / macos-test` job
running on a self-hosted runner fail at "Install Pkg" with:
sudo: a terminal is required to read the password
sudo: a password is required
Branch on `runner.environment` so:
- GitHub-hosted runners keep the production code path: `sudo installer
... -target /` into /Library, matching what end users do.
- Self-hosted runners install via `installer ... -target
CurrentUserHomeDirectory` (no sudo) into ~/Library.
The capture-once / use-many `MESHLIB_FW` env var keeps the downstream
Run MeshViewer / meshconv / brew install / example-build steps
unaware of which install target was used.
The currentUserHome domain is rejected by default by macOS pkg metadata,
so macos/Distribution.xml opts in via `<domains
enable_currentUserHome="true" enable_localSystem="true"/>`. Production
end users are unaffected -- `enable_localSystem="true"` keeps the
default system-wide /Library install available and the GUI installer
still defaults to it.
12 tasks
Grantim
approved these changes
May 21, 2026
This was referenced May 22, 2026
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.
Summary
Lets
test-distribution / macos-testrun on runners without passwordless sudo (e.g. our self-hosted macOS fleet) by installing the .pkg into~/Libraryviainstaller -target CurrentUserHomeDirectoryinstead ofsudo installer -target /.Two coordinated changes:
macos/Distribution.xml— adds<domains enable_currentUserHome="true" enable_localSystem="true"/>. macOS rejects-target CurrentUserHomeDirectoryby default unless the pkg explicitly opts into the currentUserHome domain.enable_localSystem="true"keeps the existing default system-wide install path, so end users are unaffected and the GUI installer still defaults to /Library..github/workflows/test-distribution.yml—macos-testInstall Pkg step branches onrunner.environment:sudo installer -pkg ... -target /into/Library/Frameworks/...(production install path stays exercised end-to-end).installer -pkg ... -target CurrentUserHomeDirectoryinto~/Library/Frameworks/...(no sudo).Run MeshViewer,Show meshconv help,brew install -< macos.txt, C/C++ example builds) are made install-location-agnostic by capturingMESHLIB_FWonce and putting$MESHLIB_FW/binon$GITHUB_PATH. CMake'sfind_package(MeshLib CONFIG REQUIRED)in the examples auto-discovers the framework viaCMAKE_SYSTEM_FRAMEWORK_PATH(~/Library/Frameworksis in the macOS default), so no-DCMAKE_PREFIX_PATH=is needed.Why this came up
PR #6138 expanded the
macos-testmatrix to include the self-hosted runnersmacos-arm-build-12andmacos-x64-build, and both failed at "Install Pkg" withsudo: a password is required— the runner service on those hosts runs as a non-admin user, sosudo installernever succeeds. This PR is one of the two follow-ups discussed in #6138's thread (the other is #6141, which pinnedCMAKE_OSX_DEPLOYMENT_TARGET=12.7and is now in master). With both in master, #6138 can be rebased and the full 7-runner matrix should go green.CI scope
Only macOS distribution testing is affected. Non-mac jobs are disabled via labels.
full-ciis set soupload_artifactsis true andtest-distributionactually runs frombuild-test-distribute.yml.Limitations of this PR's own CI run
Master's current
macos-testmatrix has only the two GitHub-hosted runners (macos-15-intel,macos-latest). Both take the github-hosted branch of the newif [ "${{ runner.environment }}" = "github-hosted" ], so the new self-hosted branch is not exercised by this PR's own CI. What this PR's run did verify:$GITHUB_PATHplumbing don't break the existing github-hosted path,<domains>addition toDistribution.xmldoesn't break .pkg generation or system-wide installs.The self-hosted branch is verified once #6138 rebases on top and its matrix expansion lands.
Test plan
Verified in run 26240775524:
test-distribution / macos-test (x64, macos-15-intel, *x64.pkg)still passes — .pkg installs to /Library via sudo (the github-hosted code path).test-distribution / macos-test (arm64, macos-latest, *arm.pkg)still passes — same code path.Run MeshViewer,Show meshconv help, examples builds).upload-distributionssucceeds — the<domains>addition toDistribution.xmldoesn't breakproductbuild.macos-build-testvariants compile cleanly (x64-Release, arm64-Debug, arm64-Release).macos-arm-build-12,macos-x64-build) reach "Install Pkg" without sudo and proceed through MeshViewer / meshconv / examples.