Self answering for the sake of posterity.
[SOLVED] with xcodebuild -downloadPlatform iOS
More Context:
This blog gave me a clue.
https://mokacoding.com/blog/xcodebuild-destination-options/
When adding -destination generic/platform=iOS to the xcodebuild command, it gave a different error message.
xcodebuild build -workspace getting\ started.xcworkspace -scheme "getting started" -configuration Release -destination generic/platform=iOS
Command line invocation:
/Applications/Xcode-15.app/Contents/Developer/usr/bin/xcodebuild build -workspace "getting started.xcworkspace" -scheme "getting started" -configuration Release -destination generic/platform=iOS
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Resolve Package Graph
Resolved source packages:
...
2023-10-18 11:55:34.334 xcodebuild[14094:86335] Writing error result bundle to /var/folders/c1/5nv1jx_s5ddcp_3l378t8_500000gn/T/ResultBundle_2023-18-10_11-55-0034.xcresult
xcodebuild: error: Unable to find a destination matching the provided destination specifier:
{ generic:1, platform:iOS }
Ineligible destinations for the "getting started" scheme:
{ platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device, error:iOS 17.0 is not installed. To use with Xcode, first download and install the platform }
I therefore download the iOS 17 simulator with xcodebuild -downloadPlatform iOS
And run the xcodebuild command again. It works.