Tuist edit opens in wrong version of Xcode

I have multiple versions of Xcode installed, all at /Applications/Xcode .app and use Xcode-select to activate a particular one. I se two problems:

  1. If my projects needs, for example, Xcode 10.2 I cannot have that version Xcode-selected when I need to run tuist commands, but I need it open to work with the project.
  2. So I xcode-select 11.5 or so (so I can tuist), and manually open 10.2 to work on my project
  3. Now I run “tuist edit” and see the edit open in the already open Xcode, which is incompatible with the tuist frameworks

Am I doing this wrong, or should tuist know better and derive which UI version to open from the Xcode-select directory (technically the version would be found outside that directory, just a level or two up)

Hi @dolfs :wave:

Thanks for reporting it. Based on your description it seems a legit issue. However, I’m looking at the implementation and I can’t tell why it’d not use the selected Xcode version. The command that we are running for editing your project is:

open /path/to/editable-xcodeproj.xcodeproj

My guess is that there’s a version of Xcode already opened, that’s the one that the system will use. Otherwise, it’ll sue the one selected in the system. I’ll investigate if it’s possible to do something along the lines of:

/path/to/ path/to/editable-xcodeproj.xcodeproj

I’ll keep you updated on this thread.

Actually… just found out that there’s a -a argument that we can use to specify the app to open the project with:

-a application
         Specifies the application to use for opening the file

@dolfs in case you want to take a stab at it, I opened this issue with some steps that you can follow to fix the issue.

I will not be even able to consider taking a look at forking and producing a PR until at least 2 weeks from now. Maybe even later. Sorry if that’s too long.

Regarding why the “open” command opens “the wrong one”: I think that is part of how open works, despite the comment in the manual page that says:
If no application name is specified, the

 default application as determined via LaunchServices is used to open the
 specified files.

I think if an application is open that handles the file type, that application will be used. This would explain the observed behavior.

Hey @dolfs, that’s fine :slight_smile:
I found some time today and pushed a PR that should mitigate the issue:

The change that I introduces obtains the path using xcode-select and uses the selected Xcode to open the project.

That looks good (I gave it a quick review :slight_smile:)