Xcode Commands to Build App and Run on Simulator
There will be times where you want to do these on the command line.
List the available SDKs
For example, I have iphonesimulator8.2 in my list of SDKs. This will be used in the next step.
Build the project:
xcodebuild -project '/path/to/Awesome.xcproj' -arch i386 -sdk iphonesimulator8.2
If you are using workspace, then you need to provide the scheme too:
xcodebuild -workspace '/path/to/Awesome.xcworkspace' -scheme 'Awesome-Production' -arch i386 -sdk iphonesimulator8.2
The build will be created at ~/Library/Developer/Xcode/DerivedData.
So, if the build is successful, the app will be at ~/Library/Developer/Xcode/DerivedData/Awesome-dvxamtpiqakwogarovbwiagepzxj/Build/Products/Release-iphonesimulator/Awesome.app. This path is needed in the next step.
Run on Simulator
Use ios-sim to help run on simulator.
Install it with
brew install ios-sim.
ios-sim launch <path-to-app>