{jenkins-plugin-info:pluginId=xcode-plugin|jiraComponent=xcode-plugin|adopt-message=The maintainer is looking for a co-maintainer.}

To help us maintain the plugin, you can take contact to jerome.lacoste at gmail.com in particular if you are able to test upcoming releases

Thank you!

Please use our tasks and issues tracker to report bugs, improvements or new feature.

Also if you want to propose some code change using a Github pull request, please open also a Jira issue. It is easier for developers to track them.

This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...).

Features

Versioning

This builder can invoke agvtool to dynamically update the CFBundleVersion (a.k.a. Technical Version) or CFBundleShortVersionString (a.k.a. Marketing Version). It supports all macros from the Token Macro Plugin. For example the value ${BUILD_NUMBER} will be replaced with the current build number. We advice you to generate a unique value for each build for the CFBundleVersion if you want for example deploy it into a private store. In that case you can use for example : ${JOB_NAME}-${BUILD_NUMBER}

Building

The target (optional), configuration (e.g. Debug, Release) and SDK (optional) can be specified in the per-project config along with whether to perform a clean before the build phase.

Packaging

The builder can be used to package the .app into a .ipa. Since a .app is actually a directory, it can be awkward to work with and, especially, distribute. We can simplify this by packaging the .app into a single .ipa file, which is just a
zip file with a well-known internal structure

Signing

This plugin has two features that help you simplify the code signing process.

Allowing Jenkins to stage developer profile

This plugin builds on top of Credentials Plugin to allow you to store your Apple Developer Profile (*.developerprofile) file. This file contains a code signing private key, corresponding developer/distribution certificates, and mobile provisioning profiles. You can create this file from your XCode.

To upload the developer profile into Jenkins, go to "Manage Credentials" in the system configuration page, and select "Apple Developer Profile" from the "Add" button. See Credentials Plugin for further details.

To use this profile for signing, add "Import developer profile" as a build step before you run xcode, and select the developer profile to import into the build machine. This build step will install the developer profile into the slave's keychain.

Work with existing populated keychains

If you create a dedicated keychain that stores the code signing private key and certificate on every build slave, you can configure the plugin to just unlock this keychain (so that xcode can use it for signing)

If you store your keys in the user keychain (most probably) and if you run jenkins as daemon, make sure you installed a recent version of jenkins for Mac, or configured the daemon to create a session (through the CreationSession=true parameter in your org.jenkins-ci.plist daemon config file). See also

The keychain has a default timeout of 300 seconds. One can override it using the security set-keychain-settings command, which isn't supported in the plugin today. Support in the plugin could be improved by adding options to modify the timeout as part of the build process. See JENKINS-17184.

Unit Testing

This plugin will listen to the xcodebuild output when running OCUnit or XC tests and write out JUnit-format test reports that Jenkins can understand. Jenkins will then use these to publish test failure reports and graphs.

Sample of the configuration panel

Documentation

Installation guide

Obviously, the build machine has to be an OSX machine with XCode developer tools installed.
Certificates, Identities and Provisions must be installed on the build machine separately.
Just install the latest version of the plugin from the update center and configure a freestyle job (see #Usage Guide) that will use your OSX node (If your central instance isn't running under OSX).
If xcode related binaries aren't stored in the default location, update the global configuration of the plugin (Manage Jenkins -> Configure System)


If you want to use multiple versions of Xcode to build your application, use ’Global Tool Configuration’ to register the distinguished name and location of the installed Xcode.

Usage guide
Import developer profile step

By adding the Import developer profile step to Build, you can import developer profiles exported to Xcode into temporary keychains or existing keychains.
The developer profile contains a set of certificates, secret keys and provisioning profiles necessary for compiling and signing applications, which is useful for distributing with multiple Jenkins nodes.

Import developer profile configuration parameters

Parameter

Pipeline Parameter

Since version

Description

Developer ProfileprofileId2.0.1

Select the developer profile you exported from Xcode Preference to import into the keychain. Developer profile must be registered with Jenkins in advance by "Credentials". If you do not select this column, you can specify the identifier of the developer profile registered in "Credentials" with the next "Developer Profile ID".   

Import into existing KeychainimportIntoExistingKeychain2.0.6If it is checked, the developer profile will be imported into the existing keychain. If not checked, create a new key chain with the file name "jenkins-" + "job name" newly, and import the developer profile into this. (In this case, a random character string is automatically generated and used for the password)    
Target keychainkeychainName2.0.6The name of the configured keychain to use to import certificates from developer profile to sign the package.
Keychain pathkeychainPath2.0.6Keychain path to import developer profile.
Keychain passwordkeychainPwd2.0.6Password to unlock keychain importing developer profile.

Limitations

The Xcode Integration Plugin has the function of importing the secret key and certificate of the developer account into the temporary key chain, but as the constraint of macOS can not handle different key chain for each session, the job handling the key chain If you execute them in parallel, this will not work properly.

As one of workarounds, it is impossible to limit the maximum number of jobs around Jenkins' node to 1 and to execute multiple nodes with different macOS accounts.

Setting up a build step

Add the XCode build step to a free-style project and set the target (e.g. MyApp), configuration (e.g. Release) and check the build IPA and update version number options. This will give you a single, versioned .ipa file. You can also select to clean the project before a build; while this will make sure that the project is starting from a clean state, it will make large projects take a lot longer.

Setting up a unit test step

Add the XCode build step and this time specify your unit test target (e.g. MyAppTests), configuration (e.g. Debug) and the SDK (e.g. Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/).
Leave all the checkboxes unselected. The SDK needs to be supplied here as the unit tests will only be run when building under the simulator's SDK.
Check the "Publish JUnit test result report" option in the project config and set the value "*/test-reports/*.xml" under "Test report XMLs". This will tell Jenkins to pick up the JUnit-format test reports.

XCode Builder configuration parameters

Parameter

Pipeline Parameter

Since version

Description

Development TeamdevelopmentTeamName1.4

The name of the configured development team to use to sign the package. As of XCode 8.3, this is required now to sign an ipa (which now uses xcodebuilder).

A development team can be configured here by specifying a Development Team ID, or by creating one in the jenkins global configuration.

Development Team IDdevelopmentTeamID1.4The ID of the Apple development team to use to sign the IPA If 'Development Team' is not selected.
Xcode Tools VersionxcodeName2.0.3You can select the version of Xcode set by 'Global Tool Configuration' by plugin setting.
If you choose the 'System Default' for Xcode version, plugin will not do anything, so you can switch Xcode using environment variable 'DEVELOPER_DIR' as well.   
Use Legacy Build System?useLegacyBuildSystem2.0.9Use the old 'Legacy Build System' instead of 'New Build System' of Xcode 9 and later.
Targettarget1.0The target to build. If left empty, this will build all targets in the project. If you wish to build your binary and the unit test module, it is best to do this as two separate steps each with their own target. This was, the iPhone Simulator SDK can be specified for the unit tests.
Interpret As Regular ExpressioninterpretTargetAsRegEx1.4Build all entries listed under the "Targets:" section of the xcodebuild -list output that match the regexp.     

Clean before build?

cleanBeforeBuild

1.0

This will delete the build directories before invoking the build. This will force the rebuilding of ALL dependencies and can make large projects take a lot longer.

Allow failing build results?allowFailingBuildResults1.4Checking this option will prevent this build step from failing if xcodebuild exits with a non-zero return code.
No Console Log?noConsoleLog2.0.1Checking this option will not log xcode build output to console output.
Logfile Output directorylogfileOutputDirectory2.0.1Specify the directory to output the log of xcodebuild.
If you leave it blank, it will be output to "project directory/builds/${BUILD_NUMBER}/log" with other logs.
If an output path is specified, it is output as a xcodebuild.log file in a relative directory under the "build output directory" 
ResultBundlePathresultBundlePath2.0.11Leave empty, it will not output a test result and will not analyze the test results. relative to the project-directory.
Clean ResultBundlePath?cleanResultBundlePath2.0.11This will delete the ResultBundlePath before invoking the build.
Configurationconfiguration1.0This is the name of the configuration as defined in the XCode project. By default there are Debug and Release configurations.
Xcode Schema FilexcodeSchema1.2Needed if you want to compile for a specific schema instead of a target, or if you want to generate an archive or an IPA.
Generate Archive?generateArchive2.0Checking this option will generate an xcarchive of the specified scheme. A workspace and scheme are are also needed for archives.
Pack application, build and sign .ipa?buildIpa1.0The target to build. If left empty, this will build all targets in the project. If you wish to build your binary and the unit test module, it is best to do this as two separate steps each with their own target. This was, the iPhone Simulator SDK can be specified for the unit tests.
Export methodipaExportMethod1.4The export method of the .app to generate the .ipa file. Should be one in 'development', 'ad-hoc', 'enterprise' or 'app-store'.
.ipa filename patternipaName1.4A pattern for the ipa file name. You may use ${VERSION} and ${BUILD_DATE} (yyyy.MM.dd) in this string
Output directoryipaOutputDirectory1.4The output directory for the .ipa file, relative to the build directory.
Upload Bitcode?uploadBitcode2.0.3If Checked, include bitcode in IPA exporting for App Store.
The default is "Yes" (check is on).
Upload Symbols?uploadSymbols2.0.3If Checked, include symbols in IPA exporting for App Store.
The default is "Yes" (check is on).
Compile Bitcode?compileBitcode2.0.3If checked, Xcode will recompiling Bitcode and exporting IPA for the non App Store.
The default is "Yes" (check is on).
Thinningthinning2.0.3

Set this to thin the packages for one or more devices in Xcode when exporting IPA by methods other than App Store.

Available options are:

  • <none> (Xcode export non-thinned generic application),
  • <thin-for-all-variants> (Xcode export universal applications and all available thinning variants),
  • Or for a model identifier a specific device (eg "iPhone 7, 1").

The default is <none>.

Pack on demand resources?

embedOnDemandResourcesAssetPacksInBundle

assetPacksInBundle

2.0.3Export settings for non App Store.
If the application is using on demand resources and this item is on, the asset pack is included in the application bundle, so you can test the app without the server hosting the asset pack.
If assetPacksBaseURL is not specified, the default is YES (check is on).
On demand resources asset URL

onDemandResourcesAssetPacksBaseURL

assetPacksBaseURL

2.0.3Export settings for non-App Store.
If the application is using an on demand resource and assetPacksInBundle is not YES, this must be the base URL that specifies the host of the asset pack. This will set up the app to download the asset pack from the specified URL. 
Application URLappURL2.0.3Specify the URL for installing the application when creating the manifest.plist that is necessary when OTA installing the application from Web pages or email.
Display image URLdisplayImageURL2.0.3Export settings for non App Store.
Specify the URL of the image (57 x 57 pixels) of the icon to be displayed when installing the application using manifest.plist.
Full size image URLfullSizeImageURL2.0.3Export settings for non App Store.
Specify the URL of the image (512 x 512 pixels) of the icon to be displayed when installing the application using manifest.plist.
Asset pack URLassetPackManifestURL2.0.3Export settings for non-App Store App.
If the application is using on-demand resources and the application will installing OTA with manifest.plist, this must be the base URL that specifies the host of the asset pack. This will set up the app to download the asset pack from the specified URL.
Strip Swift Symbols?stripSwiftSymbols2.0.5If checked, symbols be stripped from Swift libraries when exporting the application to IPA.
Manifest Plist URLipaManifestPlistUrl1.5

The base URL to use to create a Manifest Plist. If omitted no Manifest Plist will be generated.

Manual signing?

manualSigning

This has been deprecated and has now been replaced by "signingMethod".

2.0.1For this option you need to manually specify the combination of Provisioning profile UUID and BundleID.
This will be useful if you want to change the combination of Provisioning Profile and Certificate used for CodeSign when you build the application.
Code signing settingssigningMethod2.0.7

This attribute can take one of the following three values.

"aurtomatic" (Check "Automatic Signing")

Checking this option will automatically generate Provisioning Profile and certificates for signing application.

However, please be aware that using this function will automatically create Provisioning profile and certificates as necessary, so that old Provisioning profile and certificates will be invalid at that time.

"manual" (Check "Manual signing")

For this option you need to manually specify the combination of Provisioning profile UUID and BundleID.

This will be useful if you want to change the combination of Provisioning Profile and Certificate used for CodeSign when you build the application.

"readFromProject" (Check "Read from Xcode Project")

With this option, it automatically retrieve and sets the combination of BundleID and Provisioning profile UUID from the Xcode project file.

This is useful when you want to take over the combination of BundleID and Provisioning profile UUID that you used in the Xcode project (GUI).

Provisioning Profiles Bundle ID

provisioningProfiles: [
provisioningProfileAppId:]

2.0.1Specify the Bundle ID of the application for which code sign to be performed.
If the location of the Info.plist file contained in the compiled archive is set instead of the Bundle ID, read the Bundle ID from the Info.plist file and use that value.     
Provisioning profiles UUID

provisioningProfiles: [
provisioningProfileUUID]

2.0.1Specify the UUID or Specifire of the provisioning profile to use to sign the application. If the location of the provisioning profile is set instead of the UUID or Specifire, read the UUID from the provisioning profile and use that value.     
Copy provisioning profilecopyProvisioningProfile2.0.7

If Checked, and the filename of provisioning profile is specified in "Provisioning profile UUID", the specified file is copied to a predetermined place. ("/Users/${HOME}/Library/MobileDevice/Provisioning Profiles/")

This can be used to overwrite the contents of the developer profile or system settings in the provisioning profile in the project deployed from SCM etc.

If the provisioning profile UUID or Specifire is set in "provisioning profile UUID", it does not do anything.

The default is "Yes" (check is on)

Change bundle ID?changeBundleID1.4

Checking this option will replace the bundle identifier. 
You will need to specify which bundle ID (CFBundleIdentifier) to use and where is the Info.plist file located.
This is handy for example when you want to use a different code signing identity in your development projects.

New bundle IDbundleID1.4

The new bundle ID. Usually something like com.companyname.projectname.

Info.plist pathbundleIDInfoPlistPath1.4

The path to the info.plist file which contains the CFBundleIdentifier of your project.
Usually something like:

${WORKSPACE}/ProjectName/Project-Info.plist

Unlock Keychain?unlockKeychain1.0Automatically unlock the keychain before signing the archive?
Keychain namekeychainName1.4The name of the configured keychain to use to retrieve certificates to sign the package.
Keychain pathkeychainPath1.0The path of the keychain to use to retrieve certificates to sign the package (default : ${HOME}/Library/Keychains/login.keychain).
Keychain passwordkeychainPwd1.0The password of the keychain to use to retrieve certificates to sign the package.
Clean test reports?cleanTestReports1.3This will delete the processed test reports before invoking the build. Usually it is a good idea only to do it in test targets, otherwise if other Xcode target is built before tests – the build will fail to collect test reports.

SDK

sdk

1.0

You only need to supply this value if you want to specify the SDK to build against. If empty, the SDK will be determined by XCode. If you wish to run OCUnit tests, you will need to use the iPhone Simulator's SDK, for example: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/

SYMROOT

symRoot

1.1

You only need to supply this value if you want to specify the SYMROOT path to use. If empty, the default SYMROOT path will be used (it could be different depending of your Xcode version). Supports all macros and also environment and build variables from the Token Macro Plugin. For example you can use the value : ${WORKSPACE}/build

Custom xcodebuild arguments

xcodebuildArguments

1.3

Passing custom arguments is convenient when you need to change some project options for Jenkins build, but don't want them to persist in project file. For example when running application tests, following settings often are nice fit: GCC_SYMBOLS_PRIVATE_EXTERN=NO COPY_PHASE_STRIP=NO. Otherwise Release build will usually fail because it won't be able to find application symbols to link with test bundle. Arguments are currently separated by space, enclosing them in quotes won't help.

Xcode Workspace File

xcodeWorkspaceFile

1.2

Only needed if you want to compile a workspace instead of a project. It takes precedence over 'Xcode Project File' setting and this job 'configuration' parameter."

Xcode Project Directory

xcodeProjectPath

1.0

This is the relative path from the workspace to the directory that contains the XCode project file. You only need to supply this value if the XCode project you wish to build is not in the root of the workspace.

Xcode Project File

xcodeProjectFile

1.0

If there is more than one XCode project file in the project path, you will need to specify the file name of the project you wish to build. If you need to build all project, you will need to create an XCode build step for each one manually.

Build output directory

buildDir

1.2

The value to use for CONFIGURATION_BUILD_DIR setting (BUILD_DIR in >= 2.0.0). You only need to supply this value if you want the product of the XCode build to be in a location other than the one specified in project settings and this job 'SYMROOT' parameter. Supports all macros and also environment and build variables from the Token Macro Plugin. For example you can use the value : ${WORKSPACE}/build

Provide version number and run avgtool?provideApplicationVersion1.4Provide version number and run avgtool before invoking the build.

Marketing version

cfBundleShortVersionStringValue

1.0

This will set the CFBundleShortVersionString to the specified string. Supports all macros and also environment and build variables from the Token Macro Plugin.

Technical version

cfBundleVersionValue

1.0

This will set the CFBundleVersion to the specified string. Supports all macros and also environment and build variables from the Token Macro Plugin. For example the value ${BUILD_NUMBER} will be replaced with the current build number. We advice you to generate a unique value for each build if you want for example deploy it into a private store. In that case you can use for example : ${JOB_NAME}-${BUILD_NUMBER}

Setting up a Export IPA step

If you add the Export IPA step and set up the information necessary for exporting the IPA file, the location of the archive, the export method, code signature information, etc., you can export the IPA from the archive output in the Xcode Build step.

Export IPA configuration parameters

Parameter

Pipeline Parameter

Since version

Description

Development TeamdevelopmentTeamName2.0.1

The name of the configured development team to use to sign the package. As of XCode 8.3, this is required now to sign an ipa (which now uses xcodebuilder).

A development team can be configured here by specifying a Development Team ID, or by creating one in the jenkins global configuration.

Development Team IDdevelopmentTeamID2.0.1The ID of the Apple development team to use to sign the IPA If 'Development Team' is not selected.
Xcode Tools VersionxcodeName2.0.3You can select the version of Xcode set by 'Global Tool Configuration' by plugin setting.
If you choose the 'System Default' for Xcode version, plugin will not do anything, so you can switch Xcode using environment variable 'DEVELOPER_DIR' as well.   
Archive directoryarchiveDir2.0.1

Specify the location of the path (usually BUILD_DIR specified by xcodebuild) to read the Archive for exporting the IPA file.
Supports all macros and also environment and build variables from the Token Macro Plugin.

For example you can use the value :

${WORKSPACE}/build

Export methodipaExportMethod2.0.1The export method of the .app to generate the .ipa file. Should be one in 'development', 'ad-hoc', 'enterprise' or 'app-store'.
.ipa filename patternipaName2.0.1A pattern for the ipa file name. You may use ${VERSION} and ${BUILD_DATE} (yyyy.MM.dd) in this string
Output directoryipaOutputDirectory2.0.1The output directory for the .ipa file, relative to the build directory.
Upload Bitcode?uploadBitcode2.0.3If Checked, include bitcode in IPA exporting for App Store.
The default is "Yes" (check is on).
Upload Symbols?uploadSymbols2.0.3If Checked, include symbols in IPA exporting for App Store.
The default is "Yes" (check is on).
Compile Bitcode?compileBitcode2.0.3If checked, Xcode will recompiling Bitcode and exporting IPA for the non App Store.
The default is "Yes" (check is on).
Thinningthinning2.0.3

Set this to thin the packages for one or more devices in Xcode when exporting IPA by methods other than App Store.

Available options are:

  • <none> (Xcode export non-thinned generic application),
  • <thin-for-all-variants> (Xcode export universal applications and all available thinning variants),
  • Or for a model identifier a specific device (eg "iPhone 7, 1").

The default is <none>.

Pack on demand resources?

assetPacksInBundle

2.0.3Export settings for non App Store.
If the application is using on demand resources and this item is on, the asset pack is included in the application bundle, so you can test the app without the server hosting the asset pack.
If assetPacksBaseURL is not specified, the default is YES (check is on).
On demand resources asset URL

assetPacksBaseURL

2.0.3Export settings for non-App Store.
If the application is using an on demand resource and assetPacksInBundle is not YES, this must be the base URL that specifies the host of the asset pack. This will set up the app to download the asset pack from the specified URL. 
Application URLappURL2.0.3Specify the URL for installing the application when creating the manifest.plist that is necessary when OTA installing the application from Web pages or email.
Display image URLdisplayImageURL2.0.3Export settings for non App Store.
Specify the URL of the image (57 x 57 pixels) of the icon to be displayed when installing the application using manifest.plist.
Full size image URLfullSizeImageURL2.0.3Export settings for non App Store.
Specify the URL of the image (512 x 512 pixels) of the icon to be displayed when installing the application using manifest.plist.
Asset pack URLassetPackManifestURL2.0.3Export settings for non-App Store App.
If the application is using on-demand resources and the application will installing OTA with manifest.plist, this must be the base URL that specifies the host of the asset pack. This will set up the app to download the asset pack from the specified URL.
Strip Swift Symbols?stripSwiftSymbols2.0.5If checked, symbols be stripped from Swift libraries when exporting the application to IPA.

Manual signing?

manualSigning

This has been deprecated and has now been replaced by "signingMethod".

2.0.1For this option you need to manually specify the combination of Provisioning profile UUID and BundleID.
This will be useful if you want to change the combination of Provisioning Profile and Certificate used for CodeSign when you build the application.
Code signing settingssigningMethod2.0.7

This attribute can take one of the following three values.

"aurtomatic" (Check "Automatic Signing")

Checking this option will automatically generate Provisioning Profile and certificates for signing application.

However, please be aware that using this function will automatically create Provisioning profile and certificates as necessary, so that old Provisioning profile and certificates will be invalid at that time.

"manual" (Check "Manual signing")

For this option you need to manually specify the combination of Provisioning profile UUID and BundleID.

This will be useful if you want to change the combination of Provisioning Profile and Certificate used for CodeSign when you build the application.

"readFromProject" (Check "Read from Xcode Project")

With this option, it automatically retrieve and sets the combination of BundleID and Provisioning profile UUID from the Xcode project file.

This is useful when you want to take over the combination of BundleID and Provisioning profile UUID that you used in the Xcode project (GUI).

Provisioning Profiles Bundle ID

provisioningProfiles: [
provisioningProfileAppId:]

2.0.1Specify the Bundle ID of the application for which code sign to be performed.
If the location of the Info.plist file contained in the compiled archive is set instead of the Bundle ID, read the Bundle ID from the Info.plist file and use that value.     
Provisioning profiles UUID

provisioningProfiles: [
provisioningProfileUUID]

2.0.1Specify the UUID or Specifire of the provisioning profile to use to sign the application. If the location of the provisioning profile is set instead of the UUID or Specifire, read the UUID from the provisioning profile and use that value.     
Unlock Keychain?unlockKeychain2.0.1Automatically unlock the keychain before signing the archive?
Copy provisioning profilecopyProvisioningProfile2.0.7

If Checked, and the filename of provisioning profile is specified in "Provisioning profile UUID", the specified file is copied to a predetermined place. ("/Users/${HOME}/Library/MobileDevice/Provisioning Profiles/")

This can be used to overwrite the contents of the developer profile or system settings in the provisioning profile in the project deployed from SCM etc.

If the provisioning profile UUID or Specifire is set in "provisioning profile UUID", it does not do anything.

The default is "Yes" (check is on)

Keychain namekeychainName2.0.1The name of the configured keychain to use to retrieve certificates to sign the package.
Keychain pathkeychainPath2.0.1The path of the keychain to use to retrieve certificates to sign the package (default : ${HOME}/Library/Keychains/login.keychain).
Keychain passwordkeychainPwd2.0.1The password of the keychain to use to retrieve certificates to sign the package.

Using multiple versions of xcode.

One can easily support multiple versions by using environment variables. But first one need to install multiple versions on the build server. Here's one strategy:

install multiple versions of xcode

0. Note current config.

xcode-select -p

1. download xcode DMGs from http://developer.apple.com/downloads/

2. enable install from everywhere (under System preferences / Security)

Without that I had problems installing xcode, without graphical feedback, tested on 10.9.5, freshly booted.

Symptoms were:

Someone attempted to start application App:"Xcode" asn:0x0-1b62b61 pid:57656 refs=6 @ 0x7fa5d9f6df40 but it still has _kLSApplicationLockedInStoppedStateKey=true, so it is is staying stopped. : LASApplication.cp #2468 SetApplicationInStoppedState() q=LSSession 100027/0x186bb queue

3. open DMG file, copy app to /Applications. This might take a while.

4. close /Volumes/Xcode (otherwise installation won't start)

5. start Xcode, accept agreement, install missing packages if necessary. This might take a while. Close xcode after GUI opens.

6. move freshly installed Xcode to new path, e.g.

sudo mv /Applications/Xcode.app /Applications/Xcode6.1.app

(I use this so that the xcode app appears with version number under spotlight)

7. reset default xcode-select if necessary (installation might have changed it / reset to /Applications/Xcode.app)

sudo xcode-select -s /Applications/Xcode6.1.app

(Note the part above could be fully automated....)

Select the xcode version at runtime

1. Use EnvInject plugin
2. for jobs that require the non default do something like

DEVELOPER_DIR=/Applications/Xcode6.0.1.app/Contents/Developer

under Inject environment variables to the build process

Select the xcode version at runtime (Version 2.0.3 or later)

1. Register the distinguished name and location of the installed Xcode using ’Global Tool Configuration’.
2. Select Xcode registered in 'Global Tool Configuration' in Job's 'Xcode Tools Version'.

That's it.

FAQ

User interaction is not allowed

When code-signing, a prompt may appear on the build machine asking whether to allow keychain access.
This will block the build with a message like "User interaction is not allowed" until it is dismissed.
Just select 'Always Allow' the first time and it shouldn't need to ask again.

If this prompt is not showing on the build machine, you can force it to appear by running the codesign command that failed from a terminal on the build machine:   /usr/bin/codesign --force --sign "iPhone Distribution: .....

No Xcode folder is set
[sources] $ /usr/bin/xcodebuild -version
xcode-select: Error: No Xcode folder is set. Run xcode-select -switch <xcode_folder_path> to set the path to the Xcode folder.
Error: /usr/bin/xcode-select returned unexpected error.
FATAL: Check your XCode installation. Jenkins cannot retrieve its version.

You probably just installed XCode (by default it is in /Developer) but its path isn't configured. You can fix it with

xcode-select -switch /Developer/

You should now be able to execute xcodebuild. Ex :

host:~ user$ /usr/bin/xcodebuild -version
Xcode 4.2
Build version 4C199
Xcode 4.3

XCode 4.3 changes 2 things that are important for our usage on a slave or a master :

Changelog

Version 2.0.11 (19th Feb 2019)
Version 2.0.10 (19th Nov 2018)
Version 2.0.9 (2nd Nov 2018)
Version 2.0.8 (10th Oct 2018)
Version 2.0.7 (20th Sep 2018)
Version 2.0.6 (16th Aug 2018)
Version 2.0.5 (9th Aug 2018)
Version 2.0.4 (22th Jun 2018)
Version 2.0.3 (18th Jun 2018)
Version 2.0.2 (30th Apr 2018)
Version 2.0.1 (26th Apr 2018)
Version 2.0.0 (24th May 2017)
Version 1.4.11 (21th September 2016)

Because XXXX happens

Version 1.4.10 (20th September 2016)
Version 1.4.9 (23rd September 2015)
Version 1.4.8 (28th February, 2015)
Version 1.4.7 (5th January, 2015)
Version 1.4.6 (16th December, 2014)
Version 1.4.5 (10th December, 2014)
Version 1.4.2 (31st December, 2013)
Version 1.4.1 (30th October, 2013)
Version 1.4 (2nd Oct, 2013)
Version 1.3.1 (27th March 2012)
Version 1.3 (20th January 2012)
Version 1.2.2 (19th December 2011)
Version 1.2.1 (18th December 2011)
Version 1.2 (8th December 2011)
Version 1.1 (29th November 2011)
Version 1.0.1 (14th November 2011)
Version 1.0 (14th November 2011)

If you previously used the version provided by Ray you should be able to test this one in parallel as it has a new identity. Also you'll have to reconfigure a large part of it if you want to upgrade thus don't forget to save your settings.

Known issues