I am attempting to run the iOS simulator from the command line. I have found the location where the iPhone Simulator can be run from. My question is whether or not it can receive parameters to specify which device should be launched and what app it should run.
$ ./Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone\ Simulator
Does anyone know if there are tricks to this. Knowing more about this would really help with our Continuous Integration process.
We now use WaxSim to automate our iOS applications during CI Builds
If you want to open Simulator with specific app installed then you can use some of the ready utility to launch simulator. This way it is easy to install the app and run on the simulator. This are the command line utilities that can be run from Terminal Window.
And main thing is all uses same approach to open simulator. (see the project for more details)
Other way (not recommended by me) use script file to run from command.
Use the -SimulateApplication argument to run your executable in the simulator (executable inside the .app bundle)
(you could also compile the project from the command-line like this:) xcodebuild -project Test.xcodeproj -arch i386 -sdk iphonesimulator
Then for example:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication Test.app/Test
or
./Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateApplication Test.app/Test
You can use
xcrun simctl
to list available simulators, launch applications, etc. This tool is present in both Xcode 7 and Xcode 8. If you don't give it a command it will print command line help.xcrun simctl launch <UUID> <bundle id of app>
will start the application.Try this in your shell for Xcode 6
For Xcode 7
To launch a specific device you can do:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/Contents/MacOS/iPhone\ Simulator -SimulateDevice "iPhone Retina (3.5-inch)"