Xcode device Unavailable, runtime profile not found

pfff it was simpler than expected... when installing SO and Xcode, by some reason, the whole list of devices where removed... going to Xcode UI menu adding a new simulator in this case iPhone 6 was enough... I tried restarting and going back, and so on did not know there was an option in UI for this as I am new to XCode environment. thx for the answers.

In the XCode menu, Window --> Devices --> Add the new simulator...


I had this issue in xCode 9 and 10.2. g em

For others that ends up here with the same problem, here is what helped me:

  1. Close xCode
  2. Restart your laptop (I know it is huge bummer)
  3. Open xCode and run the build again

TL;DR:

Upgrade unavailable simulators to the latest (or the desired) iOS runtime using xcrun simctl upgrade

Details:

I was in this situation probably after performing a xcrun simctl delete unavailable with both Xcode 10 and Xcode 11 installed (and Xcode 10 as currently active).

Executing xcrun simctl list runtimes I found the iOS 13.1 runtime listed:

iOS 11.4 (11.4 - 15F79) - com.apple.CoreSimulator.SimRuntime.iOS-11-4
iOS 13.1 (13.1 - 17A844) - com.apple.CoreSimulator.SimRuntime.iOS-13-1
tvOS 13.0 (13.0 - 17J585) - com.apple.CoreSimulator.SimRuntime.tvOS-13-0
watchOS 6.0 (6.0 - 17R575) - com.apple.CoreSimulator.SimRuntime.watchOS-6-0

But when I executed xcrun simctl list, several simulators are listed as unavailable:

    iPhone 8 Plus (B08025C1-B7A2-40C0-B6D5-517EC8BB3C45) (Shutdown) (unavailable, runtime profile not found)
    iPhone Xs (0A1C1EAA-8E18-4508-9E14-C376D944984B) (Shutdown) (unavailable, runtime profile not found)
    iPhone Xs Max (84C692F5-6CF3-449D-B166-0EA26B1FAC4B) (Shutdown) (unavailable, runtime profile not found)
    iPhone Xʀ (7581E116-5CFB-4A94-94A0-30B5B8871874) (Shutdown) (unavailable, runtime profile not found)

My solution was to upgrade the unavailable simulators to the desired iOS runtime (iOS 13.1 in my case):

xcrun simctl upgrade SIMULATOR_ID "com.apple.CoreSimulator.SimRuntime.iOS-13-1"

To avoid having to perform this manually for all simulators I wrote this small ruby script to upgrade all the iPhones at once:

#!/usr/bin/ruby

uuid_regex = /([0-9A-Z]{8}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{4}-[0-9A-Z]{12})/
unavailable_iPhones = `xcrun simctl list | grep iPhone | grep "runtime profile not found"`.split("\n")
unavailable_iPhones.each do | row |
    uuid = row.match(uuid_regex).captures.first
    system("xcrun simctl upgrade #{uuid} \"com.apple.CoreSimulator.SimRuntime.iOS-13-1\"")
end