Search code examples
iosobjective-cprovisioning-profileios-provisioningxcode5

Xcode 5 "error: can't exec 'codesign' (No such file or directory)"


Someone recently posted a similar issue at can't exec 'codesign' (No such file or directory)

However, for whatever reason, it has received a down-vote rather than something helpful. So I am going to try to post this myself, with some additional data in hopes that some kind SO'er has been through this or just knows what the problem is.

I have a project that builds fine under Xcode 4.x, but ever since installing Xcode 5 DP2 (and DP3,4 and 5) and now the released version, I get this error when trying to build or archive to anything but the simulator:

CodeSign /Users/cb/Library/Developer/Xcode/DerivedData/MyApp-bdtrjmwxxokvesathmrttgwwesfq/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app
    cd /Users/cb/Development/MyAppCore/FrontEnd/Mobile/iOS/MyApp
    setenv CODESIGN_ALLOCATE /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH:/usr/local/mysql/bin:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin"
    Using code signing identity "iPhone Developer: CB (D4HZSHL6DF)" and provisioning profile "MyApp_DEV" (BB1C0589-147E-4E12-945D-8FB093B70C70)
    codesign --force --sign F5...B73 --resource-rules=/Users/cb/Library/Developer/Xcode/DerivedData/MyApp-bdtrjmwxxokvesathmrttgwwesfq/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app/ResourceRules.plist --entitlements /Users/cb/Library/Developer/Xcode/DerivedData/MyApp-bdtrjmwxxokvesathmrttgwwesfq/Build/Intermediates/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Release-iphoneos/MyApp.build/MyApp.xcent /Users/cb/Library/Developer/Xcode/DerivedData/MyApp-bdtrjmwxxokvesathmrttgwwesfq/Build/Intermediates/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app

If I open Terminal and cd to

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/

and then run the command from there, it executes just fine. So the tools seem alright, as do the provisioning profiles. The problem seems to be with Xcode itself.

It should be noted that I have deleted Xcode completely, as well as my codebase, along with all provisioning profiles and certs. I re-checked-out my code, and re-installed Xcode 5 from a fresh download, entered Apple ID into Xcode and re-created/fetched the certs and profiles, and still have the same issue.

I also went in to the project file itself and removed duplicate PROVISIONING_PROFILE entries per a couple of answers I found, to no avail.

I can build this same project from 2 other machines using Xcode 5, so it is something happening specifically on my box, or with my particular installation, it would seem. But other than that, I am stumped.

Has anyone seen/fixed this, or have any ideas of where to look for an answer?

Thanks for any input!


Solution

  • Try this:

    For Mountain Lion before starting signing process Please run below command as first command.

    For Xcode 4.x: export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate"

    For XCode 5: export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate"