`xcodebuild test` stuck because of app data container protection

Hi,

I have recently noticed a very-very annoying thing in my CI pipeline, that I managed to reproduce locally.

Using macOS Sonoma 14.7.1 and Xcode 15.4, running a test target from Terminal, the first run produces this output:

$ xcodebuild test -workspace [redacted].xcworkspace -scheme [redacted] -quiet
--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:macOS, arch:arm64, id:[redacted], name:My Mac }
{ platform:macOS, arch:x86_64, id:[redacted], name:My Mac }
{ platform:macOS, name:Any Mac }
Testing started
Test suite '[redacted]' started on 'My Mac - [redacted] (75944)'
Test case '[redacted].[redacted]()' passed on 'My Mac - [redacted] (75944)' (0.001 seconds)
Test case '[redacted].[redacted]()' passed on 'My Mac - [redacted] (75944)' (0.001 seconds)
2024-11-29 19:31:02.311 xcodebuild[75908:47784216] [MT] IDETestOperationsObserverDebug: 1.380 elapsed -- Testing started completed.
2024-11-29 19:31:02.311 xcodebuild[75908:47784216] [MT] IDETestOperationsObserverDebug: 0.000 sec, +0.000 sec -- start
2024-11-29 19:31:02.311 xcodebuild[75908:47784216] [MT] IDETestOperationsObserverDebug: 1.380 sec, +1.380 sec -- end

so the test actually completes, but the process does not end, because I get a popup that

“Terminal.app” would like to access data from other apps.

Removing the "App Sandbox" entitlement immediately alleviates this problem, but it would be very silly to do so because of unit tests.

This ultimately means that whenever we use a new device or include a new project or test target, this popup comes up. Very undesirable for CI servers (especially if the servers are ephemeral virtual machines created for the current job).

Is there a permanent solution that disables this popup for test runs?

`xcodebuild test` stuck because of app data container protection
 
 
Q