fix(bootstrap): detect Xcode installs with non-default app names on macOS#10130
Conversation
…acOS Previously script/macos/bootstrap hardcoded /Applications/Xcode.app for both the existence check and the xcode-select --switch call. This rejected valid Xcode installs managed by Xcodes.app (e.g. Xcode-26.3.0.app, Xcode-beta.app) even when xcode-select already pointed at one. Now the script first respects whatever full Xcode developer dir is already selected via xcode-select -p, and only falls back to globbing /Applications/Xcode*.app when the selection is missing or points at the Command Line Tools. The auto-switch is preserved so users with a full Xcode but CLT currently selected don't have to fix selection by hand. Fixes warpdotdev#10125
The previous fallback picked the first /Applications/Xcode*.app alphabetically, which would incorrectly select /Applications/Xcodes.app (the Xcodes installer/launcher app) when no real Xcode is present. Iterate candidates and only accept ones that actually contain Contents/Developer/usr/bin/xcodebuild.
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
…ootstrap-xcode-detection # Conflicts: # script/macos/bootstrap
There was a problem hiding this comment.
Overview
This change updates script/macos/bootstrap to honor an already-selected full Xcode developer directory and to discover non-default Xcode app names when Command Line Tools or no developer directory is selected.
Concerns
- The fallback scan can switch users from
/Applications/Xcode.appto another matching install such asXcode-beta.appor an older versioned app because shell glob expansion is lexical.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
When the user has both /Applications/Xcode.app (stable) and a versioned/beta install (e.g. Xcode-15.4.0.app, Xcode-beta.app), shell glob expansion is lexical and the older/beta name sorts before Xcode.app, which would have switched users away from the stable install the original script preferred. Try Xcode.app explicitly first, then fall back to the glob scan only if it is missing.
|
Addressed in 1bc11b0: the fallback now prefers /oz-review |
|
I'm re-reviewing this pull request in response to a review request. You can view the conversation on Warp. I reviewed this pull request and requested human review from: Comment Powered by Oz |
Oz no longer requests changes for this pull request after the latest automated review.
There was a problem hiding this comment.
Overview
This PR updates script/macos/bootstrap so it respects an already-selected full Xcode developer directory and falls back to validated /Applications/Xcode*.app candidates when CLT or no developer directory is selected.
Concerns
No blocking correctness or security concerns found in the changed lines.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
captainsafia
left a comment
There was a problem hiding this comment.
PR looks solid overall! I left one small comment inline if you're able to push a quick change to it. I'll circle back to merge it later.
Surfaces which Xcode the fallback scan picked, so users can see (and verify, since warp_sudo will prompt next) what is about to be made the active developer dir.
Description
script/macos/bootstraphardcoded/Applications/Xcode.appfor both the existence check and thexcode-select --switchcall, rejecting valid Xcode installs managed by the Xcodes app (e.g.Xcode-26.3.0.app,Xcode-beta.app) even whenxcode-select -palready pointed at one.This change:
xcode-select -p./Applications/Xcode*.appwhen nothing is selected or only Command Line Tools is selected. Each candidate is validated by checking forContents/Developer/usr/bin/xcodebuild, so the Xcodes launcher app (/Applications/Xcodes.app) is correctly skipped.xcode-select --switchso users with a full Xcode installed but CLT currently selected don't have to fix selection by hand.Fixes #10125
Testing
Validated the detection block in isolation against three states on a machine with
/Applications/Xcode-26.3.0.app(Xcodes-managed) and/Applications/Xcodes.apppresent:xcode-select— fast path is taken, no re-switch.Xcode-26.3.0.appand issues thexcode-select --switch.xcode-select -perrors) — same fallback succeeds.In all cases the
Xcodes.applauncher is skipped because it lacksContents/Developer/usr/bin/xcodebuild.