Skip to content

fix(bootstrap): detect Xcode installs with non-default app names on macOS#10130

Merged
captainsafia merged 5 commits intowarpdotdev:masterfrom
SagarSDagdu:sagar/fix-macos-bootstrap-xcode-detection
May 5, 2026
Merged

fix(bootstrap): detect Xcode installs with non-default app names on macOS#10130
captainsafia merged 5 commits intowarpdotdev:masterfrom
SagarSDagdu:sagar/fix-macos-bootstrap-xcode-detection

Conversation

@SagarSDagdu
Copy link
Copy Markdown
Contributor

@SagarSDagdu SagarSDagdu commented May 5, 2026

Description

script/macos/bootstrap hardcoded /Applications/Xcode.app for both the existence check and the xcode-select --switch call, rejecting valid Xcode installs managed by the Xcodes app (e.g. Xcode-26.3.0.app, Xcode-beta.app) even when xcode-select -p already pointed at one.

This change:

  • Respects an existing full Xcode developer dir already selected via xcode-select -p.
  • Falls back to scanning /Applications/Xcode*.app when nothing is selected or only Command Line Tools is selected. Each candidate is validated by checking for Contents/Developer/usr/bin/xcodebuild, so the Xcodes launcher app (/Applications/Xcodes.app) is correctly skipped.
  • Preserves the auto-xcode-select --switch so 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.app present:

  1. Xcode already selected via xcode-select — fast path is taken, no re-switch.
  2. Command Line Tools selected — fallback finds Xcode-26.3.0.app and issues the xcode-select --switch.
  3. Nothing selected (xcode-select -p errors) — same fallback succeeds.

In all cases the Xcodes.app launcher is skipped because it lacks Contents/Developer/usr/bin/xcodebuild.

…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.
@cla-bot cla-bot Bot added the cla-signed label May 5, 2026
@github-actions github-actions Bot added the external-contributor Indicates that a PR has been opened by someone outside the Warp team. label May 5, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 5, 2026

@SagarSDagdu

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

…ootstrap-xcode-detection

# Conflicts:
#	script/macos/bootstrap
oz-for-oss[bot]
oz-for-oss Bot previously requested changes May 5, 2026
Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.app to another matching install such as Xcode-beta.app or 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

Comment thread script/macos/bootstrap
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.
@SagarSDagdu
Copy link
Copy Markdown
Contributor Author

Addressed in 1bc11b0: the fallback now prefers /Applications/Xcode.app explicitly when present and only scans /Applications/Xcode*.app when it isn't, so stable+beta/versioned setups stay on the stable install.

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 5, 2026

@SagarSDagdu

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: @warpdotdev/oss-maintainers.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot dismissed their stale review May 5, 2026 05:41

Oz no longer requests changes for this pull request after the latest automated review.

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@oz-for-oss oz-for-oss Bot requested review from a team and captainsafia and removed request for a team May 5, 2026 05:41
Copy link
Copy Markdown
Contributor

@captainsafia captainsafia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread script/macos/bootstrap
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.
@captainsafia captainsafia merged commit 10b2540 into warpdotdev:master May 5, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed external-contributor Indicates that a PR has been opened by someone outside the Warp team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

script/macos/bootstrap fails when Xcode is installed via Xcodes app or under a non-default name

2 participants