Cannot build XCode project from command line but can from XCode

mgamer picture mgamer · Oct 3, 2011 · Viewed 39.6k times · Source

I've created in XCode a simple navigation-based iPhone app. The app builds and runs properly from under XCode but I cannot get it to build from command line.

From terminal I execute:

xcodebuild -project George.xcodeproj -alltargets -parallelizeTargets -configuration Debug build

but I get that error:

=== BUILD NATIVE TARGET George OF PROJECT George WITH CONFIGURATION Debug ===
Check dependencies
[BEROR]Code Sign error: The identity 'iPhone Developer' doesn't match any valid certificate/private key pair in the default keychain

** BUILD FAILED **


The following build commands failed:
    Check dependencies
(1 failure)

Is there something wrong with the way I try to handle it?

Answer

Bryan picture Bryan · Oct 5, 2011

In addition to unlocking the keychain, you might also specify the codesign identity (or set it in your target). Development certs take the form 'iPhone Developer: Company Inc', distribution certs like this 'iPhone Distribution: Company Inc'.

xcodebuild -project George.xcodeproj -alltargets -parallelizeTargets -configuration Debug build CODE_SIGN_IDENTITY='iPhone Developer: Company Inc'