Skip to content

fix(launcher): force uv to use managed Python (avoids macOS Xcode prompt)#322

Merged
lstein merged 2 commits into
masterfrom
lstein/fix/launcher-only-managed-python
Jun 9, 2026
Merged

fix(launcher): force uv to use managed Python (avoids macOS Xcode prompt)#322
lstein merged 2 commits into
masterfrom
lstein/fix/launcher-only-managed-python

Conversation

@lstein

@lstein lstein commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Problem

When first-run setup runs on macOS, uv tool install can 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-preference is managed, which prefers a managed
interpreter 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 makes
uv 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-managed in the launcher's uvEnv() — the single
place that configures every uv invocation, so python install, tool install,
and the GPU-reinstall path are all consistent. The launcher already pins 3.12
and runs uv python install 3.12 first; this just closes the gap where
tool install could still bind to the framework interpreter.

Also folded the same flags (--python 3.12 --python-preference only-managed)
into the documented PyPI/uv recipe across the docs and READMEs, since the
manual CLI path hit the same prompt.

Tests

  • New TestUVEnvForcesManagedPython asserts the env carries only-managed.
  • go build, go vet, go test, gofmt -l all clean.

🤖 Generated with Claude Code

lstein and others added 2 commits June 8, 2026 20:12
…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 lstein enabled auto-merge (squash) June 9, 2026 00:12
@lstein lstein merged commit a96dc83 into master Jun 9, 2026
9 checks passed
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.

1 participant