If limiting the environment helps you can try passing -UseSanitizedBuildSystemEnvironment=YES to xcodebuild
-UseSanitizedBuildSystemEnvironment=YES