How to run your Ionic app on a specific iOS simulator using the CLI

Have you ever wondered how to launch a specific iOS simulator directly using the ionic cli instead of launching XCode and choosing the simulator from the list? I have... many times... But I was always too lazy to look for the answer. As it turns out, it's pretty simple. And it's quite helpful when you want to debug your iOS app using Ionic's live reload feature!

So, as I said, when you run ionic on iOS with live reload, you run this:

$ ionic cordova run ios -l

But at the end of all these complicated build lines you can read:


No target specified for emulator. Deploying to iPhone-X, 11.4 simulator

"Oh! So I could specify a target!" And then the simulator launches and the idea of specifying a target just vanishes until the next launch.

Well, no more laziness, sir! Let's specify this bloody target!

List the available devices

There seems to be more than one command line available to do this, but hey, we only need one that's working. Just run:

$ ionic cordova emulate --list

You should see a list of all the simulators available like this:

iPhone-4s, 9.3
iPhone-5, 9.3
iPhone-5s, 10.0
iPhone-5s, 11.4
iPhone-6, 10.0
iPhone-6, 9.3
iPhone-6, 11.4
iPhone-6-Plus, 10.0
iPhone-6s, 10.0
iPhone-6s, 9.3
iPhone-6s, 11.4
iPhone-6s-Plus, 11.4
iPad-2, 9.3
iPad-Retina, 10.0
iPad-Retina, 9.3
iPad-Air, 10.0
iPad-Air-2, 10.0
iPhone-7, 11.4
iPhone-SE, 10.0

Specify the simulator to launch

OK, so now we have our available simulators. We just need to specify it to Cordova! And that's done like that:

$ ionic cordova run ios -l --target='iPhone-6, 10.0'

And that's it folks! The iPhone 6 simulator will launch instead of the default one. That was easy, right?

If you have questions or remarks concerning this article, please feel free to share them in the comments below!



I'm a freelance full stack developer working in Paris. I love everything that involves websites and mobile apps. That includes startups, UX design, growth hacking, productivity and many more.

Read More