Skip to content

Studio installer: do not run Apple's git shim to ask whether git works - #11759

Merged
danielhanchen merged 1 commit into
mainfrom
fix/mac-git-probe-clt-shim
Sep 24, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix/mac-git-probe-clt-shim

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Problem

On an Apple Silicon Mac without the Command Line Tools, /usr/bin/git is Apple's shim. Running it, even as git --version, raises the "install the command line developer tools" dialog.

install.sh's _has_working_git already avoids this by answering from the path. install_python_stack.py's _has_working_git() did not: it always ran git --version. That used to be harmless, because only the triton step asked and it is skipped on macOS.

#11405 made the pinned Diffusers main build part of the default install. _prefetch_diffusers_main, _diffusers_main_needs_dependency_pass and _diffusers_main_step all ask _has_working_git(), so every default macOS install now runs the probe. On a Mac without the CLT, that means the dialog pops up in the middle of the install. The dialog is the prompt the consumer path was built to avoid (#7547).

Fix

The Python probe now mirrors install.sh. It answers "no git" without running anything when all of these hold:

  • the machine is Apple Silicon: platform.machine() == "arm64", or sysctl hw.optional.arm64 is 1, which covers a Python running under Rosetta, as _MAC_ROSETTA does;
  • git resolves to exactly /usr/bin/git;
  • xcode-select -p fails, meaning no toolchain is selected.

Homebrew, MacPorts, Xcode.app and Intel Mac gits are still run, as in install.sh. With no working git, the installer already falls back to the pinned archive.

On the clean-machine trace leg (CLT present), the only new traced call is xcode-select -p, which notools already allows. On the mask legs the sentinel is ahead of /usr/bin on PATH, so nothing changes there.

Tests

tests/studio/install/test_git_probe_clt_shim.py runs the probe against a stand-in subprocess.run that records every command. There are 9 cases:

  • Apple Silicon, native and under Rosetta, without the CLT: git is never run;
  • the shim with the CLT installed, Homebrew git, an Intel Mac, and Linux: git is still run;
  • no git on PATH: nothing is run;
  • the shim path agrees with install.sh.

Without the fix, 3 of the 9 fail: both no-CLT rows and the install.sh agreement row. The wider installer suites (tests/studio/install, tests/python/test_install_python_stack.py) show no new failures compared with main.

Without the Command Line Tools, Apple Silicon's /usr/bin/git is a shim, and
running it (even git --version) raises the "install the command line
developer tools" dialog. install.sh's _has_working_git answers from the path
there; install_python_stack.py's ran the shim unconditionally. That was
harmless while only the triton step, skipped on macOS, asked, but since the
pinned Diffusers main build became the default (#11405) every macOS install
asks, so a Mac without the CLT got the dialog mid-install.

The Python probe now mirrors install.sh: on Apple Silicon hardware (Rosetta
included, via hw.optional.arm64), a git that resolves to exactly /usr/bin/git
with no toolchain selected (xcode-select -p fails) is answered as missing
without running it. Homebrew, Xcode.app and Intel Mac gits are still run.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T02:54:17.490146Z c0b3a1e Manual request
🔒 Security Review ⚠️ Failed 2026-09-24T02:52:39.287783Z c0b3a1e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: c0b3a1e28c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 0fc6f17 into main Sep 24, 2026
71 of 75 checks passed
@danielhanchen
danielhanchen deleted the fix/mac-git-probe-clt-shim branch September 24, 2026 03:35
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
unslothai#11759)

Without the Command Line Tools, Apple Silicon's /usr/bin/git is a shim, and
running it (even git --version) raises the "install the command line
developer tools" dialog. install.sh's _has_working_git answers from the path
there; install_python_stack.py's ran the shim unconditionally. That was
harmless while only the triton step, skipped on macOS, asked, but since the
pinned Diffusers main build became the default (unslothai#11405) every macOS install
asks, so a Mac without the CLT got the dialog mid-install.

The Python probe now mirrors install.sh: on Apple Silicon hardware (Rosetta
included, via hw.optional.arm64), a git that resolves to exactly /usr/bin/git
with no toolchain selected (xcode-select -p fails) is answered as missing
without running it. Homebrew, Xcode.app and Intel Mac gits are still run.
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