Reason: A build only device cannot be used to run this target

This is a really obscure error thrown by xcodebuild if the incorrect space (as in you pressing the spacebar) in between the -destination flag and the actual destination is used.

Example:

This will not build:

set -o pipefail && xcodebuild -project Carthage-Realm.xcodeproj -scheme Carthage-Realm -destination'platform=iOS Simulator,name=iPhone 7,OS=10.2' clean build test | tee $CIRCLE_ARTIFACTS/xcode_raw.log | xcpretty --color --report junit --output $CIRCLE_TEST_REPORTS/xcode/results.xml

but adding a space in between the -destination and 'platform=...will solve the issue.

Example:

set -o pipefail && xcodebuild -project Carthage-Realm.xcodeproj -scheme Carthage-Realm -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.2' clean build test | tee $CIRCLE_ARTIFACTS/xcode_raw.log | xcpretty --color --report junit --output $CIRCLE_TEST_REPORTS/xcode/results.xml
1 Like