xcodebuild failed without clear reason

Hello, I got a weird issue with xcodebuild, the tool gives the error that requested device could not be found but I already add it. The issue is solved if I remove the -scheme (and deveriedDataPath. Do you have any idea what is wrong with the parameter or it is the xcodebuild error itself?

haiphan@MacMini MetalTest % xcodebuild -project MetalTest.xcodeproj -destination 'platform=macOS,name=Any Mac' -scheme MetalTest

Command line invocation: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project MetalTest.xcodeproj -destination "platform=macOS,name=Any Mac" -scheme MetalTest

2025-12-05 12:18:25.594 xcodebuild[17581:2982049] Writing error result bundle to /var/folders/x7/rmx20t393rx49t6gyx3fh_vdmz2lm8/T/ResultBundle_2025-05-12_12-18-0025.xcresult xcodebuild: error: Unable to find a device matching the provided destination specifier: { platform:macOS, name:Any Mac }

The requested device could not be found because no available devices matched the request.

Available destinations for the "MetalTest" scheme:
	{ platform:macOS, arch:arm64, id:00006020-000E29861AE8C01E, name:My Mac }
	{ platform:macOS, arch:x86_64, id:00006020-000E29861AE8C01E, name:My Mac }
	{ platform:macOS, name:Any Mac }
xcodebuild failed without clear reason
 
 
Q