Skip to content

Open Xcode by bundle ID rather than app name - #6160

Merged
DanTup merged 1 commit into
Dart-Code:masterfrom
10xtushar:fix-open-in-xcode-bundle-id
Sep 1, 2026
Merged

DanTup merged 1 commit into
Dart-Code:masterfrom
10xtushar:fix-open-in-xcode-bundle-id

Conversation

@10xtushar

Copy link
Copy Markdown
Contributor

Fixes #6159

openInXcode currently launches Xcode by application name:

safeToolSpawn(folder, "open", ["-a", "XCode", file]);

open -a resolves via LaunchServices by app name, so this fails when the only installed Xcode is Xcode-beta.app:

$ open -a "XCode" ios/Runner.xcworkspace
Unable to find application named 'XCode'
$ echo $?
1

Because the safeToolSpawn result isn't checked, nothing surfaces in the UI and the context-menu item appears to do nothing at all. This affects anyone working against an iOS/macOS beta, who generally can't install a stable Xcode for the current SDK alongside the beta.

This switches to launching by bundle ID, which both Xcode.app and Xcode-beta.app declare:

$ defaults read /Applications/Xcode-beta.app/Contents/Info.plist CFBundleIdentifier
com.apple.dt.Xcode

-b uses the same LaunchServices database as -a, just keyed on bundle ID rather than name, so it should continue to work for Xcode installed outside /Applications (#5420). It also removes the reliance on open -a being case-insensitive for "XCode".

The .xcworkspace/.xcodeproj discovery above this line is unchanged — only the launch call differs.

Testing: verified by patching the compiled extension.js in an installed 3.140.0 extension and restarting the editor; Open in Xcode then correctly opens Runner.xcworkspace in Xcode 27 beta. I haven't run the full extension test suite locally — happy to if you'd like, though there's no existing coverage for openInXcode.

`open -a "XCode"` resolves via LaunchServices by application name, which
fails when the only installed Xcode is `Xcode-beta.app` — a common setup
for anyone on an iOS/macOS beta, who cannot install a stable Xcode for the
current SDK alongside it.

Both `Xcode.app` and `Xcode-beta.app` declare the bundle ID
`com.apple.dt.Xcode`, so `open -b` locates either. It uses the same
LaunchServices database as `-a`, keyed on bundle ID rather than name, so
this keeps working for Xcode installed outside /Applications (Dart-Code#5420).

Fixes Dart-Code#6159

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

@DanTup DanTup left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@DanTup DanTup added this to the v3.144.0 milestone Sep 1, 2026
@DanTup DanTup added is enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix. on mac in commands Relates to commands (usually invoked from the command Palette) labels Sep 1, 2026
@DanTup

DanTup commented Sep 1, 2026

Copy link
Copy Markdown
Member

Bot breakage is unrelated, there was an issue on master when this was branched that is since fixed.

Thanks for the PR!

@DanTup
DanTup merged commit 7bec864 into Dart-Code:master Sep 1, 2026
5 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in commands Relates to commands (usually invoked from the command Palette) is enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix. on mac

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open in Xcode does nothing when Xcode is installed as Xcode-beta.app

2 participants