Xcode 6 - Launch simulator from command line

Balaji Sekar picture Balaji Sekar · Sep 25, 2014 · Viewed 84.7k times · Source

I want to launch iPhone simulator from command line.

until now I have been using the below command

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator -SimulateDevice

-SimulateDevice is used to launch a specific device type

Now with Xcode 6 the path and the app has been changed to

/Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app/Contents/MacOS/iOS Simulator

but sadly -SimulateDevice option is not working now. I can launch the simulator, but dont have an option to specify which one to launch

Anyone found any alternatives for this with Xcode 6?

Answer

Balaji Sekar picture Balaji Sekar · Sep 25, 2014

Found a way to achieve what I wanted.

Apple has introduced an interesting tool with Xcode 6!

simctl

simclt allows you to control the simulator that are running.

run xcrun simctl to get the list of available subcommands. Lots of new options to play around with.

Now to do what I wanted, here is the command to launch the simulator:

xcrun instruments -w "iPhone 5 (8.0 Simulator)"

-w is to provide a device type and to get the list of available devices.

Just execute this:

xcrun instruments -s

After launching the simulator you can control it using simctl

To install your app:

xcrun simctl install booted <app path>

To launch the app:

xcrun simctl launch booted <app identifier>

Hope this helps.