17

As of Xcode 7†, the xcodebuild export archive step has been giving us errors.

Build command

xcodebuild -exportArchive -archivePath "path/to/Thing.xcarchive" \
        -exportPath "path/to/" \
        -exportOptionsPlist path/to/PackageOptions-adhoc.plist

yields

2015-10-08 16:28:27.409 xcodebuild[62682:464728] [MT] IDEDistribution: Step failed: <IDEDistributionThinningStep: 0x7ff1a42d23f0>: Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo=0x7ff1a72ddd80 {NSLocalizedDescription=No applicable devices found.}
error: exportArchive: No applicable devices found.

Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found." UserInfo=0x7ff1a72ddd80 {NSLocalizedDescription=No applicable devices found.}

** EXPORT FAILED **

What gives? How to fix?


† 7.0 & 7.0.1, on Mavericks.

1

3 Answers 3

25

In our case, this was a conflict with our use of a non-system ruby via rvm. To fix, you need to call xcodebuild inside the context of rvm use system. But doing this is complicated by the fact that using rvm in scripts is harder than it should be.

We created a script which fixed this for us:

#!/bin/bash --login
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
rvm use system
xcodebuild "$@"

This is a drop-in replacement for xcodebuild, where

xcodebuild arg1 ... argn

would become

path/to/xcbuild-safe.sh arg1 ... argn

I've gisted a production-ready version. Make sure you chmod +x on that file.

5
  • 3
    Jeeez, same issue here. Thanks for the fix and Google for indexing it :-)
    – zrzka
    Commented Oct 15, 2015 at 18:44
  • This wasn't sufficient for use. We had to unset some more variables after calling rvm use system. I commented the gist. Commented Jan 6, 2016 at 18:02
  • @coffeebreaks Thanks, I updated the gist script per your comment. If you get the chance, check the update to see if it looks OK. Commented Jan 6, 2016 at 23:13
  • 2
    @ClayBridges looks OK. I packaged it for use in fastlane/gym and made it work in non rvm environments. Hopefully it will be merged in a few days. Here's the PR github.com/fastlane/gym/pull/176 and the current version: github.com/lacostej/gym/blob/features/wrap_xcodebuild/lib/… Commented Jan 8, 2016 at 12:49
  • 1
    For those building using the XCode GUI instead of from the terminal, I was able to use this solution by closing XCode, running rvm use system and then opening XCode up again. Thanks @ClayBridges Commented Oct 5, 2016 at 14:26
3

So the underlying issues as as alluded by Clay Bridges answer is that there is an error happening in Ruby. To be specific, this error is being caused by using an out of date version of the CFPropertyList gem.

You can simply update this gem to fix the problem. xcodebuild uses the system ruby, so simply do this:

/usr/bin/gem install CFPropertyList
0
3

Make sure xcodebuild using the system ruby.

I fixed it by doing this:

rvm use system
1
  • EXPORT SUCCEEDED after using this command, but i do not see application running on device, am i doing something wrong? Can you please guide? Commented Sep 11, 2017 at 6:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.