xcodebuild hangs for some users, not all

Mac OS: 12.3.1 Monterey (Mac Mini 202 Xcode: 13.4.1

'xcodebuild -version' hangs indefinitely for most users, except for one local admin account and one non-admin account (LDAP user). I've searched high and low and found some related issues on this forum and elsewhere, most of which indicate that the Xcode license has not been accepted and provide instructions to accept it from the command line. All of these have been tried countless times, plus Xcode 13.4.1 and CommandLineTools have been reinstalled, and still the issue remains: Only one non-admin user (myself) and the local admin user can run 'xcodebuild' from the command line without hanging. The same is true from Mac Terminal application in a remote console (VNC) session, or putty/xterm connected remotely via ssh.

We can't upgrade Mac OS or Xcode as this is a build/test machine in a server farm and the specific OS and Xcode versions are required minimums for customer support purposes.

Doesn't seem that there is setting unique to each user that could enable/disable Xcode, but the inner workings of Mac OS and Xcode remain largely a mystery.

Please help!

If it helps, profiling the hung process shows it's waiting for a synchronus reply. This machine is in an isolated network, and has no internet access.

Call graph:
    2449 Thread_20227   DispatchQueue_1: com.apple.main-thread  (serial)
    + 2449 start  (in dyld) + 462  [0x10e34e51e]
    +   2449 XcodeBuildMain  (in libxcodebuildLoader.dylib) + 1286  [0x10a14d5d5]
    +     2449 -[Xcode3CommandLineBuildTool run]  (in Xcode3Core) + 1814  [0x10a449e55]
    +       2449 LSRegisterURL  (in LaunchServices) + 61  [0x7ff801990dbc]
    +         2449 _LSRegisterBundleURL  (in LaunchServices) + 133  [0x7ff8019f5e0d]
    +           2449 _LSRegisterBundleNode  (in LaunchServices) + 68  [0x7ff8019f5ea3]
    +             2449 LaunchServices::Database::Context::_get(unsigned int const*, unsigned long)  (in LaunchServices) + 86  [0x7ff801a01e26]
    +               2449 _LSContextInitCommon(LSContext*, unsigned int const*, unsigned long, NSError* __autoreleasing*)  (in LaunchServices) + 546  [0x7ff8019550d7]
    +                 2449 _LSCopyServerStore  (in LaunchServices) + 819  [0x7ff801895f34]
    +                   2449 _NSXPCDistantObjectSimpleMessageSend1  (in Foundation) + 56  [0x7ff8022187b5]
    +                     2449 -[NSXPCConnection _sendSelector:withProxy:arg1:]  (in Foundation) + 119  [0x7ff80221887f]
    +                       2449 -[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]  (in Foundation) + 3163  [0x7ff802210f56]
    +                         2449 __NSXPCCONNECTION_IS_WAITING_FOR_A_SYNCHRONOUS_REPLY__  (in Foundation) + 9  [0x7ff802212f16]
    +                           2449 xpc_connection_send_message_with_reply_sync  (in libxpc.dylib) + 238  [0x7ff801074dc4]
    +                             2449 dispatch_mach_send_with_result_and_wait_for_reply  (in libdispatch.dylib) + 50  [0x7ff80119813e]
    +                               2449 _dispatch_mach_send_and_wait_for_reply  (in libdispatch.dylib) + 514  [0x7ff801197d41]
    +                                 2449 mach_msg  (in libsystem_kernel.dylib) + 56  [0x7ff8012fece8]
    +                                   2449 mach_msg_trap  (in libsystem_kernel.dylib) + 10  [0x7ff8012fe97a]
    2449 Thread_20228
      2449 start_wqthread  (in libsystem_pthread.dylib) + 15  [0x7ff801336f57]
        2449 _pthread_wqthread  (in libsystem_pthread.dylib) + 426  [0x7ff801338034]
          2449 __workq_kernreturn  (in libsystem_kernel.dylib) + 10  [0x7ff80130005a]
code-block

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report, include the information you have provided so far in this forums post, and post the FB number here once you do.

Bug Reporting: How and Why? has tips on creating your bug report.

Done. Bug FB15271895.

xcodebuild hangs for some users, not all
 
 
Q