Simulator selected by tuist run is ambiguous

@cneville When you run the command with --verbose, you should see the exact arguments we pass to xcodebuild. Could you grab that and post it here? That could shed some light.

Sure @marekfort - with the command:

tuist run MyPodiumApp -d 'iPhone 16' -o '18.0' --verbose

I get the following output:

Running xcodebuild command: /usr/bin/xcrun xcodebuild build -scheme MyPodiumApp -workspace /Users/connorneville/Documents/Development/CleanFoundry/MyPodium/mp-frontend/mp-frontend.xcworkspace -destination id=F4214C8D-143A-4827-B00D-15F3D83F7521
/usr/bin/xcrun xcodebuild build -scheme MyPodiumApp -workspace /Users/connorneville/Documents/Development/CleanFoundry/MyPodium/mp-frontend/mp-frontend.xcworkspace -destination id=F4214C8D-143A-4827-B00D-15F3D83F7521
Command line invocation:
    
/Applications/Xcode_16.app/Contents/Developer/usr/bin/xcodebuild build -scheme MyPodiumApp -workspace /Users/connorneville/Documents/Development/CleanFoundry/MyPodium/mp-frontend/mp-frontend.xcworkspace -destination id=F4214C8D-143A-4827-B00D-15F3D83F7521
User defaults from command line:
    IDEPackageSupportUseBuiltinSCM = YES
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:F4214C8D-143A-4827-B00D-15F3D83F7521, OS:18.0, name:iPhone 16 }
{ platform:iOS Simulator, id:F4214C8D-143A-4827-B00D-15F3D83F7521, OS:18.0, name:iPhone 16 }

and as mentioned above, this is after wiping ~/Library/Developer/CoreSimulator/Devices - so it seems that something about my system is producing duplicate simulators somehow.

Looking at the xcodebuild command:

/usr/bin/xcrun xcodebuild build \
-scheme MyPodiumApp \
-workspace /Users/connorneville/Documents/Development/CleanFoundry/MyPodium/mp-frontend/mp-frontend.xcworkspace \
-destination id=F4214C8D-143A-4827-B00D-15F3D83F7521

The simulator is referenced by an ID – that should make it unambiguous which simulator is selected.

Curious if you see the simulator twice if you run xcrun simctl list? Does the warning go away if extra arguments are passed, such as -sdk iphonesimulator?

Here is the thing. xcrun simctl list returns the correct list of simulators with no duplicates. Simulators list in Xcode is also correct.
But xcodebuild shows the warning about duplicate simulators with exactly same names and identifiers.

--- xcodebuild: WARNING: Using the first of multiple matching destinations:
[14:18:34]: ▸ { platform:iOS Simulator, id:666353D8-E564-4859-A0E9-D2B5C47E77AE, OS:18.2, name:iPhone 16 Pro }
[14:18:34]: ▸ { platform:iOS Simulator, id:666353D8-E564-4859-A0E9-D2B5C47E77AE, OS:18.2, name:iPhone 16 Pro }

Removing all simulators from Xcode and disk and then recreating them doesn’t help.
I’m sure this is not a Tuist issue. Maybe there is some garbage left after installing new versions of Xcode / beta versions and deleting old versions idk.

Hard to say – but it’s not the first time I’m seeing. It’s most likely an Xcode issue, though :confused: I wonder if the Xcode warning goes away if you don’t specify an ID, but use for example the device name. In other words, does the warning occur only when you pass a destination ID? Does it happen with other simulators (that is what happens if you pass a different valid simulator ID?)

Specifying only Device name doesn’t help