Reputation: 4166
All I want to do is be able to do the same thing as Cmd
+ R
that I'm able to do in Xcode, except from the Terminal. But so far look at multiple stack overflow posts and articles have left me lost.
So far I've been able to run the simulator from the command line:
open -a Simulator --args -CurrentDeviceUDID <UDID for iPhone 7>
But I've been unable to install and launch the application using these commands
xcrun simctl install booted <PATH-TO-APPLICATION-BUNDLE>
xcrun simctl launch booted <BUNDLE-ID-OF-APP-BUNDLE>
I don't know how to find the <PATH-TO-APPLICATION-BUNDLE>
. I'm assuming it's not as easy as just putting the path to the .xcodeproj
...
If anyone could write the steps & specific commands I need to (1) build .xcodeproj
from command line and (2) run the app on the simulator from the command line that would be greatly appreciated!
P.S. I know there are tools like ios-sim that probably make this whole process easier, but I'd like to do it raw (i.e. using Xcode command line tools)
Upvotes: 2
Views: 3580
Reputation: 2740
You can use this command to launch and run the app
$ ios-sim launch --devicetypeid "iPhone-7" ".app path"
Upvotes: -1
Reputation: 1156
(1) To build you project I suggest you check this link https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html
(2) This is an example on how I launched an app on simulator
List devices
xcrun simctl list
Boot device
(example)
xcrun simctl boot "iPhone 5"
or (example)
xcrun simctl boot E9469085-68B9-450A-A716-87F013C9AF56
Install .app (gotta find your Library folder.. could be hidden)
format: xcrun simctl install < device > < .app path > (example)
xcrun simctl install "iPhone 5" "MyUserPath/Library/Developer/Xcode/DerivedData/CustomTransitions-edghiwbzifosladnxssmsfwzykxg/Build/Products/Debug-iphonesimulator/CustomTransitions.app"
Shutdown device
xcrun simctl boot "iPhone 5"
Open simulator (this is my path.. yours can be different)
open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app
Launch the app
format: xcrun simctl launch booted < bundle id >
xcrun simctl launch booted "com.example.apple-samplecode.CustomTransitions"
Upvotes: 4