Build with xcodebuild for Mac Catalyst Apple Silicon

I'm trying to build a framework supporting Apple Silicon with Mac Catalyst. The project builds fine in Xcode with the "Any Mac" destination.
If I use the command
Code Block
xcodebuild -project "project.xcodeproj" -configuration "Release" -scheme "MyScheme" -destination "generic/platform=macOS,variant=Mac Catalyst,name=Any Mac"

I get the error
Code Block
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ generic:1, platform:macOS, variant:Mac Catalyst, name:Any Mac }
Unsupported device specifier option.
The device “My Mac” does not support the following options: name
Please supply only supported device specifier options.
...
Ineligible destinations for the "MyScheme" scheme:
{ 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 }

I'm not sure why the destination is listed as ineligible when it builds correctly in Xcode, or why xcodebuild seems to use the "My Mac" device when generic is enabled.
How can I build for Mac Catalyst on Apple Silicon with xcodebuild?

Replies

what xcode command line tools are you currently using with that? same problem here.
XCODE -> Preference -> Locations -> Command Line Tools
Hi,

I don't have a solution to your problem, but I can tell you why it fails.

According to the xcodebuild man page, when platform is set to macOS, the only other keys that can be included in your destination specifier are arch and variant.

Sorry I can't help any further.

H.