Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 12 Beta - Cannot find simulator runtime

I have installed Xcode 12 beta 2. I tried to run our xamarin project through Jenkins on Mac OS Catalina. It fails with the below error. When I build the same project from Mac Visual studio, it succeeded without any error.

SplashViewController.storyboard : error :
 iOS 14.0 (14.0 - 18A5319g) - com.apple.CoreSimulator.SimRuntime.iOS-14-0 (unavailable, failed to open liblaunchsim.dylib) ==> not available:
  Error Domain=com.apple.CoreSimulator.SimError Code=401 "The iOS 14.0 simulator runtime is not available."
  UserInfo={NSLocalizedDescription=The iOS 14.0 simulator runtime is not available.,
   NSUnderlyingError=0x7fef8847b520 {Error Domain=NSPOSIXErrorDomain Code=53 "Software caused connection abort"
  UserInfo={NSLocalizedFailureReason=XPC error talking to SimLaunchHostService: <error: 0x7fff97d649a0> { count = 1, transaction: 0, voucher = 0x0,_

I also did xcrun simctl list to view the available runtime simulators for Xcode 12 beta. It shows the below list but fails while building.

== Runtimes ==

iOS 14.0 (14.0 - 18A5319g) -
com.apple.CoreSimulator.SimRuntime.iOS-14-0
tvOS 14.0 (14.0 - 18J5331g) -
com.apple.CoreSimulator.SimRuntime.tvOS-14-0
watchOS 7.0 (7.0 - 18R5327h) -
com.apple.CoreSimulator.SimRuntime.watchOS-7-0

== Devices ==

When I opened Xcode Settings and clicked to Components -> Simulator I do not see iOS 14 in the list:

Can anyone help me to resolve this?

like image 841
Priya22 Avatar asked Jul 13 '20 11:07

Priya22


People also ask

How do I enable simulator in Xcode?

Open Xcode and click Menu > Xcode > Preferences > Select Components, and then choose the simulator version you want to download.


2 Answers

This command can fix the issue:

sudo xcrun simctl shutdown all && sudo xcrun simctl erase all

And I found it here: https://developer.apple.com/forums/thread/653807

like image 68
S.H. Peng Avatar answered Oct 01 '22 03:10

S.H. Peng


I am seeing this issue on Xcode 12.1 using the default install of Jenkins. None of these solutions work, and the "manual run of the sh script" results in Jenkins not even being able to load at all.

I am using a build command against a device (not a simulator) that looks like this:

/usr/bin/xcodebuild -scheme MyApp -workspace MyApp.xcworkspace -configuration Debug clean build DEVELOPMENT_TEAM=XXXXXXXXXX -allowProvisioningUpdates test -destination platform=iOS,id=theIDofADeviceNotASimulator

This command runs fine when I run it from the command prompt of my regular admin console user, but not from Jenkins.

Jenkins is installed normally under its own /users/Shared/Jenkins account.

Also, I see that in the Xcode 12.2 release notes (I am on 12.1) there is still a "known issue" that says Simulators may not be available when running command-line tools like simctl or xcodebuild from a non-root LaunchDaemon, or when launching as a different user from the current user (for example, with sudo or launchctl). (62188195) - https://developer.apple.com/documentation/xcode-release-notes/xcode-12_2-beta-release-notes

The issue seems to exist on the devices as well as the simulators.

UPDATE The solution is to reinstall Jenkins using homebrew under your regular user, have them auto-login, then use a LaunchAgent attached to that user to start jenkins when your user logs in.

Jenkins no longer supports being installed using the "jenkins user" and running as a LaunchDaemon, and neither does Xcode.

like image 29
Russell Dobda Avatar answered Oct 01 '22 01:10

Russell Dobda