How To Download iOS Simulator To Fix Xcode Error Can’t Select iOS Simulator

After I upgrade my Xcode to version 10.3, I found all the iOS simulators which I used before have lost. And when I build or run the iOS app in Xcode, it will use a Generic iOS Device only, but I do not have a real iOS device connected to my Mac computer at all, so the build will fail. So I need to add an iOS simulator to the Xcode again to build and run my iOS app. This article will tell you how to do it.

1. How To Download iOS Simulators Package In Xcode.

  1. Click Set the active scheme drop-down list in Xcode toolbar, then click Download Simulators… item.
  2. If you can not find the Download Simulators… item, you can click Xcode —> Preferences menu item at Xcode top menu bar.
  3. Then click the Components tab to open the iOS simulator download dialog like below. Click the down arrow before the iOS simulator which you need to download to download it, after download clicks the Check and Install Now button to install it. You may need to provide the macOS user account to process the installation.

2. How To Add / Remove iOS Simulator From Xcode.

  1. After download the selected version iOS simulator package, by default it will install all the iOS simulators of that version in the Xcode, you can add more or remove the special iOS simulators from Xcode follow the below steps.
  2. Click Window —> Devices and Simulators menu item at Xcode top menu bar.
  3. There are two tabs in the popup dialog window, click the Simulators tab, then click the plus icon ( + ) at the bottom left corner of the popup dialog window to open the add simulator dialog.
  4. Give the simulator a name ( for example iPhone X ), select related Device Type and iOS Version, then click Create button to create a new simulator. After this action, you can see the newly created iOS simulator at the left list panel.
  5. If you want to remove one iOS simulator, you should first open the Simulators window like above then right-click one simulator in the left simulator list, then click Delete menu item in the popup menu list.

3. How To Reinstall Downloaded iOS Simulator Package In Xcode.

  1. If you want to fully remove one iOS simulator version package from Xcode and then reinstall it again, you can follow the below steps.
  2. Open a terminal and go to directory /Library/Developer/CoreSimulator/Profiles/Runtimes, you can find all the downloaded iOS simulator package directory files in it like below.
    # go to iOS simulator package install directory.
    $ cd /Library/Developer/CoreSimulator/Profiles/Runtimes
    # display current directory path.
    $ pwd
    # list all the iOS simulator package directory files that has been installed.
    $ ls -l
    total 0
    drwxrwxr-t  3 root  admin  96 Sep  3 22:48 iOS 12.0.simruntime
    drwxrwxr-t  3 root  admin  96 Aug 14 21:59 iOS 12.1.simruntime
    drwxrwxr-t  3 root  admin  96 Aug 14 20:50 iOS 12.2.simruntime
  3. Then you can remove the iOS simulator packages which you do not need with the below command.
    $ sudo rm -rf ./iOS\ 12.2.simruntime/
  4. Now, you can restart Xcode to download and reinstall the removed iOS simulator packages which you need follow the steps in section 1 of this article.

4. How To Use The Newly Created iOS Simulator.

  1. After creating the iOS simulator follow the above steps, when you click the Set the active scheme drop-down list at the Xcode toolbar, you can find and select the iOS simulator that you added to run your code.
  2. If you still can not find the iOS simulator that you added, this may be because you choose the wrong iOS Deployment Target version than which you downloaded. You can change the iOS Deployment Target version by clicking the Xcode project name ( TestProject ) in Xcode left navigator pane, then click the project name ( TestProject ) in the center editor PROJECT pane, then click Info tab at the top, and change the iOS Deployment Target version from the drop-down list in the Deployment Target section.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.