Launch specific device simulator

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)?


Solution 1:

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.