xcodebuild keeps defaulting to Mac Catalyst

Ok, I'm going crazy here. I have a static library for iOS that I want to build for the simulator. I use xcodebuild -destination="iOS Simulator" and then check the library using otool which tells me the platform is 6, which is Mac Catalyst.

When I look at the output of xcodebuild, it says

--- xcodebuild: WARNING: Using the first of multiple matching destinations: { platform:macOS, arch:arm64, variant:Mac Catalyst, id:00006041-0008492E3AA1801C, name:My Mac } ...

It has the simulator listed too, way down the list: { platform:iOS Simulator, arch:x86_64, id:AB7A99B3-8D24-4F73-A42D-9BB45321928D, OS:18.6, name:iPad (A16) }

When I put all of that into xcodebuild for the platform, it still says there are multiple matching destinations and chooses Mac Catalyst. Why? How? What? Does platform="iOS Simulator" mean nothing? How in the world does "Mac Catalyst" match "iOS Simulator"?????

I don't want Mac Catalyst, I don't need Mac Catalyst, and I can't get rid of Mac Catalyst. Nothing I specify in xcodebuild results in anything I can build that will compile for the simulator.

What the heck am I doing wrong?

What happens if you update your -destination option with the value generic/platform=iOS Simulator instead?

— Ed Ford,  DTS Engineer

It says it's matching multiple destinations and going with Mac Catalyst.

Putting ANYTHING into -destination results in Mac Catalyst. Even if I give it an exact match for iOS or MacOS, I get Mac Catalyst.

    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild archive -project netcdf.xcodeproj -scheme netcdf-simulator "-destination=generic/iOS Simulator, arch:x86_64, id:AB7A99B3-8D24-4F73-A42D-9BB45321928D" -archivePath=archives/netcdf_simulator

--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, variant:Mac Catalyst, id:00006041-0008492E3AA1801C, name:My Mac }
{ platform:macOS, arch:x86_64, variant:Mac Catalyst, id:00006041-0008492E3AA1801C, name:My Mac }
{ platform:macOS, arch:arm64, variant:Designed for [iPad,iPhone], id:00006041-0008492E3AA1801C, name:My Mac }
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
{ platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
{ platform:macOS, variant:Mac Catalyst, name:Any Mac }
{ platform:iOS, arch:arm64, id:00008101-001C61991A90001E, name:August’s iPhone }
{ platform:iOS Simulator, arch:arm64, id:AB7A99B3-8D24-4F73-A42D-9BB45321928D, OS:18.6, name:iPad (A16) }
{ platform:iOS Simulator, arch:x86_64, id:AB7A99B3-8D24-4F73-A42D-9BB45321928D, OS:18.6, name:iPad (A16) }
{ platform:iOS Simulator, arch:arm64, id:EC02D77D-5ECA-4CB1-9BD0-6CEB91BBD832, OS:18.6, name:iPad Air 11-inch (M3) }
{ platform:iOS Simulator, arch:x86_64, id:EC02D77D-5ECA-4CB1-9BD0-6CEB91BBD832, OS:18.6, name:iPad Air 11-inch (M3) }
{ platform:iOS Simulator, arch:arm64, id:0BC29FE6-1F8B-4DCD-AD47-5CADA2E5CC06, OS:18.6, name:iPad Air 13-inch (M3) }
{ platform:iOS Simulator, arch:x86_64, id:0BC29FE6-1F8B-4DCD-AD47-5CADA2E5CC06, OS:18.6, name:iPad Air 13-inch (M3) }
{ platform:iOS Simulator, arch:arm64, id:B24E869E-FDF7-45ED-BEE5-1D9615EE007D, OS:18.6, name:iPad Pro 11-inch (M4) }
{ platform:iOS Simulator, arch:x86_64, id:B24E869E-FDF7-45ED-BEE5-1D9615EE007D, OS:18.6, name:iPad Pro 11-inch (M4) }
{ platform:iOS Simulator, arch:arm64, id:4B6B605E-2B33-4848-88AC-44BDF6D23715, OS:18.6, name:iPad Pro 13-inch (M4) }
{ platform:iOS Simulator, arch:x86_64, id:4B6B605E-2B33-4848-88AC-44BDF6D23715, OS:18.6, name:iPad Pro 13-inch (M4) }
{ platform:iOS Simulator, arch:arm64, id:53CF6E78-17DC-45B9-9CCF-65610F9DD8E0, OS:18.6, name:iPad mini (A17 Pro) }
{ platform:iOS Simulator, arch:x86_64, id:53CF6E78-17DC-45B9-9CCF-65610F9DD8E0, OS:18.6, name:iPad mini (A17 Pro) }
{ platform:iOS Simulator, arch:arm64, id:56E721D4-8795-4EF0-92C1-7624D0FB2201, OS:18.6, name:iPhone 16 }
{ platform:iOS Simulator, arch:x86_64, id:56E721D4-8795-4EF0-92C1-7624D0FB2201, OS:18.6, name:iPhone 16 }
{ platform:iOS Simulator, arch:arm64, id:9BFA0CE5-E6EB-42F4-9C73-530393B8B2B0, OS:18.6, name:iPhone 16 Plus }
{ platform:iOS Simulator, arch:x86_64, id:9BFA0CE5-E6EB-42F4-9C73-530393B8B2B0, OS:18.6, name:iPhone 16 Plus }
{ platform:iOS Simulator, arch:arm64, id:056553B1-63F4-4BB3-A115-2656BC5F6C2B, OS:18.6, name:iPhone 16 Pro }
{ platform:iOS Simulator, arch:x86_64, id:056553B1-63F4-4BB3-A115-2656BC5F6C2B, OS:18.6, name:iPhone 16 Pro }
{ platform:iOS Simulator, arch:arm64, id:AFEA9301-5373-48D5-B5F1-B49FC4DFF6E2, OS:18.6, name:iPhone 16 Pro Max }
{ platform:iOS Simulator, arch:x86_64, id:AFEA9301-5373-48D5-B5F1-B49FC4DFF6E2, OS:18.6, name:iPhone 16 Pro Max }
{ platform:iOS Simulator, arch:arm64, id:8452A8F2-5026-4259-BA10-F6E8BEABF137, OS:18.6, name:iPhone 16e }
{ platform:iOS Simulator, arch:x86_64, id:8452A8F2-5026-4259-BA10-F6E8BEABF137, OS:18.6, name:iPhone 16e }

For some reason it put the quotes around -destination but the command line is -destination="generic/iOS Simulator..."

Something odd is happening here. Here's a test to run, which I also just did for myself:

  1. Create a brand new Xcode project, static library template
  2. Set the Skip Install build setting to No since you are using archive builds
  3. Run the following commands:
% xcodebuild archive -project Test.xcodeproj -scheme Test -destination="generic/iOS Simulator" -archivePath /Some/Path/To/Test.xcarchive
%  otool -l /Some/Path/To/Test.xcarchive/Products/usr/local/lib/libTest.a | grep LC_BUILD_VERSION -A4

If that outputs anything but 7 for the platform, please open a bug report, attach your test project and the exact commands and their output from above, and then post the FB number here for my reference.

In my test run with the above, I got platform 2, i.e. iOS, not the simulator, but also not Mac Catalyst as in your original post.

— Ed Ford,  DTS Engineer

xcodebuild keeps defaulting to Mac Catalyst
 
 
Q