xcodebuild gives an error for multiple implementation of AMSupportURLConnectionDelegate and AMSupportURLSession : "Which one is undefined."

When I want to run any xcodebuild action it gives me the following error while the Xcode ide is working fine on Apple M1.

> xcodebuild -version
objc[72320]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libauthinstall.dylib (0x1dc35ab90) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x105ca42c8). One of the two will be used. Which one is undefined.
objc[72320]: Class AMSupportURLSession is implemented in both /usr/lib/libauthinstall.dylib (0x1dc35abe0) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x105ca4318). One of the two will be used. Which one is undefined.
Xcode 13.2.1
Build version 13C100

Both classes are implemented in /usr/lib/libauthinstall.dylib and also im another module, so I wanted check the /usr/lib/libauthinstall.dylib but it is not accessible

> open /usr/lib/libauthinstall.dylib
The file /usr/lib/libauthinstall.dylib does not exist.

I had the same issue again on M1. It seems the xcodebuild executable is Intel based. The error does not show if the xcodebuild process is started from a terminal running under Rosetta.

My Xcode was installed from the App Store.

Managed to fix it for terminal without Rosetta by removing Xcode and installing the 13.3 Xcode beta from: https://download.developer.apple.com/Developer_Tools/Xcode_13.3_beta/Xcode_13.3_beta.xip

Now the xcodebuild executable is compiled for Apple silicon and the issue is gone.