Fail to generate Xcode project with GenerateProjectFiles

I had the same problem on Ventura using Xcode 14.2 and UE 5.1.1
I resolved it using these commandline.

cd ..../Epic Games/UE_5.1/Engine/Build/BatchFiles
./RunUAT.command Turnkey -command=verifySDK -platform=Mac

It seems that Unreal Engine requires an older version of Xcode and command line tools to create a project, but on Ventura, it is not possible to install Xcode 13.x or earlier versions.

I think It is recommended to avoid upgrade macOS to recent version if possible.