title: React-Native CLI run-ios script attempts to run app on non-existent simulator
body: <p>xcode 12 <br />
  react-native cli 4.13.1 <br />
  cocoapods 1.10.1 <br />
  react 0.63.4 <br /></p>
  <p>I've encountered this problem more than once on my project, the first time I ended up rebuilding. I'm not sure what is causing it. When I &quot;run-ios&quot;, the simulator is being chosen incorrectly, and attempts to run on a not present device.</p>
  <pre><code>:~/source/personal/&lt;project&gt;$; npx react-native run-ios --verbose 
  debug Reading /Users/&lt;user&gt;/source/personal/&lt;project&gt;/ios/Podfile
  debug Reading /Users/&lt;user&gt;/source/personal/&lt;project&gt;/ios/Podfile
  debug Reading /Users/&lt;user&gt;/source/personal/&lt;project&gt;/ios/Podfile
  error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually: 
    - @react-native-community/geolocation (to unlink run: &quot;react-native unlink @react-native-community/geolocation&quot;)
    - @react-native-community/picker (to unlink run: &quot;react-native unlink @react-native-community/picker&quot;)
    - react-native-maps (to unlink run: &quot;react-native unlink react-native-maps&quot;)
  This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via &quot;react-native unlink &lt;dependency&gt;&quot; and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
  Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
  debug Reading /Users/&lt;user&gt;/source/personal/&lt;project&gt;/ios/Podfile.lock
  info Found Xcode workspace &quot;&lt;project&gt;.xcworkspace&quot;
  info Building (using &quot;xcodebuild -workspace &lt;project&gt;.xcworkspace -configuration Debug -scheme &lt;project&gt; -destination id=FCBFA5B8-2A42-4B0F-AC8A-D43A1CC7C08E&quot;)
  debug Command line invocation:
      /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace &lt;project&gt;.xcworkspace -configuration Debug -scheme &lt;project&gt; -destination id=FCBFA5B8-2A42-4B0F-AC8A-D43A1CC7C08E
  
  
  error Failed to build iOS project. We ran &quot;xcodebuild&quot; command but it exited with error code 70. To debug build logs further, consider building your app with Xcode.app, by opening &lt;project&gt;.xcworkspace.
  Command line invocation:
      /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace &lt;project&gt;.xcworkspace -configuration Debug -scheme &lt;project&gt; -destination id=FCBFA5B8-2A42-4B0F-AC8A-D43A1CC7C08E
  
  
  xcodebuild: error: Unable to find a destination matching the provided destination specifier:
          { id:FCBFA5B8-2A42-4B0F-AC8A-D43A1CC7C08E }
  
      Available destinations for the &quot;&lt;project&gt;&quot; scheme:
          { platform:iOS Simulator, id:C671E44A-5901-4054-AABE-26394319C7D5, OS:14.4, name:iPad (8th generation) }
          { platform:iOS Simulator, id:FA9E687C-9E94-48E4-8592-BFFA51CFB107, OS:14.4, name:iPad Air (4th generation) }
          { platform:iOS Simulator, id:25FF1BD1-D6BF-481C-9B98-2F31417A1A1D, OS:14.4, name:iPad Pro (9.7-inch) }
          { platform:iOS Simulator, id:C9EBBEB7-D7C2-460E-AEF7-D0E41EF35051, OS:14.4, name:iPad Pro (11-inch) (2nd generation) }
          { platform:iOS Simulator, id:96529FA3-C77A-4969-8BB4-5FDF0C336630, OS:14.4, name:iPad Pro (12.9-inch) (4th generation) }
          { platform:iOS Simulator, id:EBEB0DE3-6D3E-4AAC-8EF5-AFE9659E72CB, OS:14.4, name:iPhone 8 }
          { platform:iOS Simulator, id:E252FD89-6E65-49DD-8A00-403626444DB5, OS:14.4, name:iPhone 8 Plus }
          { platform:iOS Simulator, id:41237E14-D8AF-4383-BC35-A7065F7F2A46, OS:14.4, name:iPhone 11 }
          { platform:iOS Simulator, id:23AA1BD3-0187-4522-99A8-75526721A2D2, OS:14.4, name:iPhone 11 Pro }
          { platform:iOS Simulator, id:EA72F6D7-B1DB-4EA9-9447-1D3FDFC2DA1A, OS:14.4, name:iPhone 11 Pro Max }
          { platform:iOS Simulator, id:CE1BFE8D-7326-4B38-A2C1-D91E43D05622, OS:14.4, name:iPhone 12 }
          { platform:iOS Simulator, id:1B59D058-57A5-4A8C-AA87-8FB531318C02, OS:14.4, name:iPhone 12 Pro }
          { platform:iOS Simulator, id:AE03D9A6-8D32-4F5F-AB34-AB91CD0E925B, OS:14.4, name:iPhone 12 Pro Max }
          { platform:iOS Simulator, id:9A59AE8D-695A-4882-9E32-5D053B1BCEA6, OS:14.4, name:iPhone 12 mini }
          { platform:iOS Simulator, id:8CBF1BCA-5731-4868-B726-38DC1EB527F1, OS:14.4, name:iPhone SE (2nd generation) }
          { platform:iOS Simulator, id:88114D51-5164-4C7F-BFA6-354FC6B4B22C, OS:14.4, name:iPod touch (7th generation) }
  
      Ineligible destinations for the &quot;&lt;project&gt;&quot; scheme:
          { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }
          { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }
  </code></pre>
  <p>By digging into the scripts, I've found that the following code from <code>&lt;project&gt;/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js</code> chooses the simulator:</p>
  <pre><code>async function runOnSimulator(xcodeProject, scheme, args) {
    let simulators;
  
    try {
      simulators = JSON.parse(_child_process().default.execFileSync('xcrun', ['simctl', 'list', '--json', 'devices'], {
        encoding: 'utf8'
      }));
    } catch (error) {
      throw new (_cliTools().CLIError)('Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues.', error);
    }
    /**
     * If provided simulator does not exist, try simulators in following order
     * - iPhone X
     * - iPhone 8
     */
  
  
    const fallbackSimulators = ['iPhone X', 'iPhone 8'];
    const selectedSimulator = fallbackSimulators.reduce((simulator, fallback) =&gt; {
      return simulator || (0, _findMatchingSimulator.default)(simulators, {
        simulator: fallback
      });
    }, (0, _findMatchingSimulator.default)(simulators, args));
  
    if (!selectedSimulator) {
      throw new (_cliTools().CLIError)(`No simulator available with ${args.simulator ? `name &quot;${args.simulator}&quot;` : `udid &quot;${args.udid}&quot;`}`);
    }
  ...
  </code></pre>
  <p>but I am having a hard time understanding the code and figuring out why it's failing. Clearly, from here, I can hack in the target simulator I want to use, but I'd rather figure out where that's being cached and clear it out. Help?</p>