noamtm
noamtm

Reputation: 12983

Building iOS applications using xcodebuild without codesign

We're building an app for another company. They hold the signing key and would rather not share it with us.

It should be possible to separate build and sign, but how do I specify it on xcodebuild's command line?

Upvotes: 79

Views: 70701

Answers (6)

Ahmet Geymen
Ahmet Geymen

Reputation: 1

Using xcodebuild build with build option CODE_SIGN_IDENTITY="" allows building the project without requiring any provision profile. As a sample command below works with Xcode 15.4.

xcodebuild build -scheme <your-scheme> CODE_SIGN_IDENTITY=""

You can find out many more build settings in the build settings reference page.

P.S. CODE_SIGNING_REQUIRED or CODE_SIGNING_ALLOWED options are not mentioned in the build settings reference. Based on my own tests, they don't seem to have any significant effect on building without a provisioning profile.

Upvotes: 0

Berik
Berik

Reputation: 8143

Note that variables need to be put at the end of the command, or they will not have an effect:

xcodebuild <action> <arguments> CODE_SIGNING_ALLOWED=NO

Upvotes: 5

Joern
Joern

Reputation: 2123

In order to skip the code signing you can perform a manual build from the console like this:

xcodebuild clean build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO

Additionally, use the -configuration, -target and -sdk parameters in order to define your build settings.

Refer to this Stack Overflow answer in order to get a detailed description on how to disable code-signing inside Xcode.

Upvotes: 155

user3672430
user3672430

Reputation: 106

In the Project Navigator, select your project and open the "Build Settings" section of your project (and not any particular target).

Under "Code Signing", find "Code Signing Identity" and for both Debug and Release modes set "Any iOS SDK" to "Don't Code Sign".

Upvotes: 4

Ben Flynn
Ben Flynn

Reputation: 18922

To completely prevent code signing with Xcode 7, I used all of the following options:

CODE_SIGN_IDENTITY=""
CODE_SIGNING_REQUIRED="NO"
CODE_SIGN_ENTITLEMENTS=""
CODE_SIGNING_ALLOWED="NO"

The final option, CODE_SIGNING_ALLOWED="NO" seemed to do the trick.

Upvotes: 62

Mike Weller
Mike Weller

Reputation: 45598

Unfortunately it can be hard to build your app in release mode without code signing. You will get errors from the build system such as this:

CodeSign error: code signing is required for product type 'Application' in SDK
                'iOS 5.1'

In this case, you should configure your target to use your developer/team wildcard (*) signing identity in Release mode. The app will be signed with that when you build it, and you can ship it to your customer so they can resign it. This is what most of our outsourced developers do.

You may then be able to remove the code signing information by deleting the various files in the app like _CodeSignature and using the codesign tool to remove information from the application binary. But I'm not sure how easy that is. It's not really essential though. There isn't any sensitive information in the provisioning profile or signing information.

Upvotes: 9

Related Questions