Build and run an app on simulator using xcodebuild Build and run an app on simulator using xcodebuild xcode xcode

Build and run an app on simulator using xcodebuild


Ok. Figured out the issue.

You need to specify the correct destination. For example.

xcrun xcodebuild \  -scheme $XCODE_SCHEME \  -project $XCODE_PROJECT \  -configuration Debug \  -destination 'platform=iOS Simulator,name=iPhone 6 Plus,OS=9.1' \  -derivedDataPath \  build

In this way Xcode will create the folder (called build) containing your products (in particular look at Debug-iphonesimulator). The build dir is created within the dir you are running the xcodebuild command.

Now you can point that folder in order to run the ios-sim command (see ios-sim for more references) or simctl (see iOS 8: Building custom simulators and Build And Run iOS Apps In Commmand Line for more info).