5

How can I launch the device simulator on a Mac and specify which specific device I want, for example an iPhone 6s or an iPhone X, without having to launch Xcode (which takes forever on my old Mac)?

3 Answers 3

-2

Here's one way (with two variations) to do what you want:

Begin by using Terminal to open the iOS Simulator.app's enclosing folder:

cd /Applications/Xcode.app/Contents/Developer/Applications/; open .

Now you need to make a choice. If you use the Simulator often enough to keep its icon in the Dock, then go ahead and drag it in. If not, your other choice right click on the app's icon and select Make Alias, then drag the alias into the "Applications" directory.

All done in twenty seconds, and welcome to Ask Different!

10

You can use simctl command from xcrun. Here's how to do it:

$ xcrun simctl list

Sample output:

(...)
== Devices ==
-- iOS 12.2 --
    iPhone X (AC5DA9BB-2198-4E6B-9CFC-A407730FF853) (Shutdown) 
    iPhone Xs (69A34565-5621-419C-8F37-3089FEFA52C1) (Shutdown) 
    iPhone Xs Max (8192F2B2-3F3F-49C1-AC36-D88550D48FCA) (Shutdown) 
(...)

The string in braces is UUID of the simulator device.

Boot the device with:

$ xcrun simctl boot $UUID

Now launch the simulator with:

$ open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/

If you do not need to switch the Simulator type, just run the last command.

More info about simctl and how to use it see the NSHipster article.

1
  • Working like a charm
    – Rotem
    Jun 15, 2020 at 14:14
0

You can specify the device the simulator should run with using the --simulator flag, followed by the device name as a string.

In my case, I do: react-native run-ios --simulator="iPhone 6s"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .