macOS runner: "Failed to load CoreSimulator framework" in CI
simctl loaded a CoreSimulator framework whose version does not match the running CoreSimulator service. This happens when xcode-select switched Xcode but the old simulator service is still resident.
What this error means
A simctl or xcodebuild test command fails with "Failed to load CoreSimulator framework." or a "mismatch ... rebuild" message, even though the simulator worked earlier in the job.
Failed to load CoreSimulator framework. Error Domain=NSCocoaErrorDomain Code=256
"The bundle ... couldn't be loaded because it is damaged or missing necessary resources."Common causes
Xcode was switched mid-job
Changing the active Xcode with xcode-select leaves the previous CoreSimulator service running against a different framework version, so loads fail.
A stale simulator service is resident
The com.apple.CoreSimulator.CoreSimulatorService process holds an old framework version that no longer matches the selected Xcode.
How to fix it
Restart the CoreSimulator service after switching Xcode
- Select the Xcode you intend to use.
- Kill the resident CoreSimulator service so it reloads the matching framework.
- Re-run simctl or the tests.
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo pkill -9 -f CoreSimulatorService || true
xcrun simctl list devicesAvoid switching Xcode after the simulator starts
Pick the Xcode version once at the start of the job so the simulator framework and service stay consistent.
How to prevent it
- Select Xcode once at the start, before any simulator use.
- Restart CoreSimulatorService if you must switch Xcode.
- Pin a single Xcode version per job.