Collecting and exporting code signing files with codesigndoc

The open source codesigndoc tool runs a clean Xcode Archive on your Mac, and analyzes the generated archive file. It collects the code signing settings that Xcode used during the archive process, and prints the list of the required code signing files. You can also search for, export and upload these files using codesigndoc.

If your project contains UITest targets, codesigndoc can scan for those, too. It runs the xcodebuild build-for-testing action to create a, and exports the necessary code signing files.

Collecting and uploading the files with codesigndoc

You can use codesigndoc for:

  • Xcode projects.

The app does not have to be a native iOS app: you can use the tool with an app built with a third-party framework, such as Flutter, if you have an .xcodeproj or .xcworkspace file.

You can install the latest version of codesigndoc with a simple one-liner or you can manually download and install the specific version you want to use:

In the below example, we’ll use the one-liners.

  1. Open the Terminal.

  2. Go to your project’s folder.

  3. Enter the appropriate one-liner command, depending on your project type.

    • For a Xcode project:

      bash -l -c "$(curl -sfL"  
  4. The tool will automatically scan your project and look for a .xcodeproj or .xcworkspace file and do the rest.

    If the scanner does not find the files, open your and drag-and-drop your project’s .xcodeproj or .xcworkspace file into the command line in your Terminal.

  5. Once the code signing files are collected, codesigndoc will ask if you wish to upload the files to Bitrise:

    Do you want to upload the provisioning profiles and certificates to Bitrise? [yes/no] :  

    If you wish to upload the files with codesigndoc, type yes and press Enter.

  6. Provide your Bitrise access token:

    Please copy your personal access token to Bitrise.
    (To acquire a Personal Access Token for your user, sign in with that user on,
    go to your Account Settings page, and select the Security tab on the left side.) :  

    Personal access tokens

  7. Select the Bitrise project as a target for the collected files:

    Fetching your application list from Bitrise...
    Select the app which you want to upload the provisioning profiles
    Please select from the list:

That’s all, you are done!

Automatic code signing asset management

For automatic code signing asset management, we recommend you use one of our code signing and building Steps:

You can also install and run codesigndoc manually. For more information, check out the tool’s Readme!

Scanning for UITest targets

If your Xcode project has UITest targets, you can use codesigndoc to export the necessary code signing files and generate an .xctestrun file. You need to do this if you want to run UI tests on real devices with the help of Bitrise - for example, with the iOS Device Testing Step.

  1. Make sure you have a scheme that has a valid UITest target that is enabled.

    Collecting and exporting code signing files with codesigndoc
    Collecting and exporting code signing files with codesigndoc
  2. Open the Terminal.

  3. Use our one-liner to launch the scanner and export the required code signing files:

    bash -l -c "$(curl -sfL"       

    This command runs the xcodebuild build-for-testing action to create a UITest runner .app file, and exports the necessary code signing files.

  4. Upload the files to Bitrise with codesigndoc.

Troubleshooting the UITest scanner

If the UITest scanner cannot find the desired scheme, follow these steps:

  1. Make sure your scheme is valid for running a UITest.

    It has to contain a UITest target that is enabled to run.

  2. Refresh your project settings:

    • Select the Generic iOS Device target for your scheme in Xcode.

    • Clean your project: ⌘ Cmd + ↑ Shift + K.

    • Run a build for testing: ⌘ Cmd + ↑ Shift + U.

  3. Run codesigndoc again.

Manually installing and using codesigndoc

With manual install, you can specify which version of codesigndoc you want to use. Unlike with the one-liners used above, the manual install does not automatically run the scan command in the folder you use it in: it merely installs the tool.

Check out the available versions on the releases page of the codesigndoc tool.

  1. Download the release you want by running a curl command:

    Note: replace the VERSIONNUMBER with the actual number of the codesigndoc version you want.

    curl -sfL > ./codesigndoc
  2. Make the downloaded binary executable:

    chmod +x ./codesigndoc
  3. Run the scan command any time you wish:

    ## Xcode scanner
    ./codesigndoc scan xcode
    ## Xcode project scanner for UI test targets
    ./codesigndoc scan xcodeuitests

Best practices of using codesigndoc

You get the most accurate result if you run codesigndoc on the same state of your repository/code which is available after a clean git clone, as that will be the state of the code after the build server checks it out (for example, you might have files on your Mac which are in .gitignore, so it exists on your Mac but not in the repository or after a git clone on a new Mac).

So, for the best results, we recommend you to:

  1. Do a clean git clone of your repository (into a new directory) on your Mac.

  2. Run codesigndoc in this directory (not in the directory where you usually work on the project).

We also recommend generating an IPA on your local machine first, and run codesigndoc after that. The reason is that Xcode might download or update profiles in the background during the IPA export. If you run codesigndoc after you exported a IPA from Xcode, codesigndoc will able to collect all the files.