If you are like me, upgrading to macOS Sonoma 14.2 must have wreaked havoc on your Xamarin.iOS development flow. That's right, I said Xamarin.iOS, I know .NET Maui is what I should be talking about, but I'm not ready to move on just yet.
Now yesterday, I was having a great time, finishing up a project that I have been working on since forever. There was an update pending on my Mac, so I decided to let it run as I took lunch. After the upgrade, I could no longer run my app on Xamarin.iOS, I got the error:
Failed to locate any simulator runtime matching options: { BuildVersionString = 21C52; Platforms = ( "com.apple.platform.iphonesimulator" ); VersionString = "17.2";}
What this meant, simply, was my specified iOS simulator version (17.2) is not installed on the machine. So I ran over to xcode to install it, the only problem was, the thing kept failing in the middle of a download cycle and didn't resume upon failure, so I had to restart, fail, repeat. After about 6 or 7 failures, countless restarts, code cleans and failed rebuilds, I figured the issue could be from Apple. So I set out to research and found the following workaround.
First, download the iOS Simulator 17.2 Runtime.dmg from your Apple Developer Account. The direct link is https://developer.apple.com/download/all/
You can then run the following command:
xcrun simctl runtime add "Path to downloaded dmg file" e.g. xcrun simctl runtime add "~/Downloads/iOS_17.2_Simulator_Runtime.dmg"