fix(launcher): force uv to use managed Python (avoids macOS Xcode prompt)#322
Merged
Conversation
…mpt)
On macOS, uv's default --python-preference ("managed") still falls back to a
system/framework CPython when one matches. The python.org framework build is not
relocatable, so building the tool venv from it makes uv rewrite Mach-O load
paths with install_name_tool, which triggers the Xcode Command Line Tools
install dialog during first-run setup.
Set UV_PYTHON_PREFERENCE=only-managed in the launcher's uvEnv() so every uv call
(python install, tool install, GPU reinstall) uses uv's relocatable managed
builds and never the framework Python. The launcher already pins/installs a
managed 3.12; this just closes the gap where tool install could still pick up
the framework interpreter. Add a regression test for the env.
Fold the same flags into the documented PyPI/uv recipe across the docs and
READMEs (--python 3.12 --python-preference only-managed) so the CLI path avoids
the prompt too.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
lstein
added a commit
that referenced
this pull request
Jun 9, 2026
…d of forcing managed Python (#324) PR #322 tried to suppress the macOS "install Xcode Command Line Tools" dialog by forcing uv to use a managed CPython (UV_PYTHON_PREFERENCE= only-managed), on the theory that the framework Python's non-relocatable binary was what made uv run install_name_tool. Testing on a cold Mac disproved that: uv runs install_name_tool while building the tool venv regardless of which interpreter it uses, so the dialog fires immediately either way. The tools aren't actually needed — the install completes fine whether the user accepts or cancels — and there's no clean way to stop the prompt. So revert the only-managed approach and instead set the right expectation: before uv runs on macOS, if `xcode-select -p` shows the Command Line Tools are absent, print a short warning that the dialog will appear and is safe to dismiss, pause ~5s so it's read, then proceed. - launcher/uv.go: drop UV_PYTHON_PREFERENCE=only-managed; add warnIfXcodeToolsMissing() and call it at the top of install(). - launcher/uv_test.go: TestUVEnvForcesManagedPython -> TestUVEnvRedirectsState (the dir-redirect coverage stays; the only-managed assertion is gone). - docs/README: revert the `--python 3.12 --python-preference only-managed` recipe back to `uv tool install photomapai --torch-backend auto` and drop the now-false note that it avoids the macOS prompt. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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
When first-run setup runs on macOS,
uv tool installcan trigger an Xcode"install command-line developer tools" dialog — an annoying interruption for
non-technical users the signed launcher is meant to serve.
Root cause
uv's default
--python-preferenceismanaged, which prefers a managedinterpreter but falls back to a system/framework CPython if it finds a
matching version. On macOS that's the non-relocatable python.org build at
/Library/Frameworks/Python.framework/.... Building the tool venv from it makesuv rewrite the copied executable's Mach-O load paths with
install_name_tool(part of the Xcode CLT) — which pops the install dialog when the CLT aren't
present. uv's managed (python-build-standalone) builds are relocatable, so they
never invoke
install_name_tool.Fix
Set
UV_PYTHON_PREFERENCE=only-managedin the launcher'suvEnv()— the singleplace that configures every
uvinvocation, sopython install,tool install,and the GPU-reinstall path are all consistent. The launcher already pins 3.12
and runs
uv python install 3.12first; this just closes the gap wheretool installcould still bind to the framework interpreter.Also folded the same flags (
--python 3.12 --python-preference only-managed)into the documented PyPI/
uvrecipe across the docs and READMEs, since themanual CLI path hit the same prompt.
Tests
TestUVEnvForcesManagedPythonasserts the env carriesonly-managed.go build,go vet,go test,gofmt -lall clean.🤖 Generated with Claude Code