'failed to open liblaunch_sim.dylib' but only when run by CI

I'm attempting to upgrade to Xcode 12.0 on our CI machines which are managed by Buildkite. We use fastlane scan to run our unit tests.

If I run our fastlane script manually on the CI machine, it works fine. However, when buildkite-agent runs the same script it fails with the error "No simulators found on local machine".

Turns out when buildkite-agent is running the script, xcrun simctl list reports 'unavailable, failed to open liblaunch_sim.dylib'. But not if I run the script manually on the same machine!

Code Block
== Devices ==
-- iOS 14.0 --
iPhone 8 (4D50331C-EA89-4338-B723-4C97D49B743E) (Shutdown) (unavailable, failed to open liblaunch_sim.dylib)
iPhone 8 Plus (19297DDA-2932-4E19-B1AF-932A3E908E7D) (Shutdown) (unavailable, failed to open liblaunch_sim.dylib)
iPhone 11 (737394AD-611B-46E0-9821-D8F474CB8CF6) (Shutdown) (unavailable, failed to open liblaunch_sim.dylib)
iPhone 11 Pro (CF74C14E-FF16-42B8-BD13-1EF9BCC67454) (Shutdown) (unavailable, failed to open liblaunch_sim.dylib)
iPhone 11 Pro Max (6B406CEE-89E8-49AA-AB7F-89E10BE6E47F) (Shutdown) (unavailable, failed to open liblaunch_sim.dylib)
iPhone SE (2nd generation) (D50EB1B2-EFD7-475A-B325-98290ECC9A6E) (Shutdown) (unavailable, failed to open liblaunch_sim.dylib)
iPad Pro (9.7-inch) (A2973191-E1FB-4B72-85A0-817EB240C671) (Shutdown) (unavailable, failed to open liblaunch_sim.dylib)
iPad (7th generation) (5245FAE6-0AF9-4486-9472-468F569F684C) (Shutdown) (unavailable, failed to open liblaunch_sim.dylib)
iPad Pro (11-inch) (2nd generation) (6A94E8D1-FFE8-41AB-8BF6-2C583E5C61C9) (Shutdown) (unavailable, failed to open liblaunch_sim.dylib)
iPad Pro (12.9-inch) (4th generation) (7E419C55-846E-4AE7-9806-ACDEE5D346F2) (Shutdown) (unavailable, failed to open liblaunch_sim.dylib)
iPad Air (3rd generation) (5BDC647C-CCAB-434F-BFBD-4FD0015C0779) (Shutdown) (unavailable, failed to open liblaunch_sim.dylib)
-- tvOS 14.0 --
-- watchOS 7.0 --
== Runtimes ==
iOS 14.0 (14.0 - 18A372) - com.apple.CoreSimulator.SimRuntime.iOS-14-0 (unavailable, failed to open liblaunch_sim.dylib)
tvOS 14.0 (14.0 - 18J383) - com.apple.CoreSimulator.SimRuntime.tvOS-14-0 (unavailable, failed to open liblaunch_sim.dylib)
watchOS 7.0 (7.0 - 18R382) - com.apple.CoreSimulator.SimRuntime.watchOS-7-0 (unavailable, failed to open liblaunch_sim.dylib)


And if I run xcrun simctl list manually on the machine, the unavailable message isn't there.

What could be the difference between the script being run manually and run by buildkite? AFAICT the buildkite process isn't run under a different user account. Unsure what else to check for.

Thanks!
Same issue is discussed here since beta:

https://developer.apple.com/forums/thread/653807

No solution yet ...
'failed to open liblaunch_sim.dylib' but only when run by CI
 
 
Q