Signing app with xcodebuild command line with PROVISIONING_PROFILE fails

19,146

Using PROVISIONING_PROFILE is deprecated since Xcode8. Try PROVISIONING_PROFILE_SPECIFIER instead. PROVISIONING_PROFILE_SPECIFIER="Human Readable Prov Profile Name"

It may also be necessary to turn off Xcode's Automatic Signing:

Xcode9: simply append CODE_SIGN_STYLE="Manual" to your xcodebuild command

Xcode8: sed -i '' 's/ProvisioningStyle = Automatic;/ProvisioningStyle = Manual;/' TestApp/TestApp.xcodeproj/project.pbxproj && xcodebuild ...

You can check your Xcode Version on the command-line with xcodebuild -version

Share:
19,146
TheWaterProgrammer
Author by

TheWaterProgrammer

#include <AlwaysAStudent> int main(int argc, char *argv[]) { std::thread always_keep_learning([&] { Learn(); }); always_keep_learning.detach(); return 0; }

Updated on June 04, 2022

Comments

  • TheWaterProgrammer
    TheWaterProgrammer almost 2 years

    I trying to sign my app command line using Xcode.

    Running xcodebuild command-line on MyApp.xcodeproj like so:

    xcodebuild -project "MyApp.xcodeproj" -target "MyApp" -sdk "iphoneos" -configuration *Release* PROVISIONING_PROFILE="xxxx-xxxx-xxxx-xxxx" CODE_SIGN_IDENTITY="iPhone Developer: something.com (SOMEVALUE)"
    

    Gives following error:

    Check dependencies
    Provisioning profile "iOS Team Provisioning Profile: *" doesn't include signing certificate "iPhone Developer: something.com (SOMEVALUE)".
    Provisioning profile "iOS Team Provisioning Profile: *" is Xcode managed, but signing settings require a manually managed profile.
    Code signing is required for product type 'Application' in SDK 'iOS 10.3'
    
    ** BUILD FAILED **
    

    What is wrong ? What is missing in my xcodebuild command ?

    How can I include the signing certificate that its asking about ?

    What I tried from answer & comments below
    As I understand, a dedicated distribution profile should be used with Release build. That is present in the system. I just need to know how to use it with xcodebuild command for manual signing if I can.

    Executing security find-identity -p codesigning -v | grep "$CODE_SIGN_IDENTITY" gives a list of 5 signing identities ones of them clearly states as iPhone Distribution: My Company (SOME123ID).

    *So, can I use the distribution profile with xcodebuild manual signing? If yes, How can I get the actual ID of a distribution profile to use with xcodebuild command?

  • TheWaterProgrammer
    TheWaterProgrammer almost 7 years
    I tried PROVISIONING_PROFILE_SPECIFIER="iOS Team Provisioning Profile: *" with xcodebuild command. I also tried the ID of the provisioning profile. Both didnt work. the error says No iOS profile matching 'iOS Team Provisioning Profile: *' found: Xcode couldn't find a profile matching 'iOS Team Provisioning Profile: *'. Install the profile (by dragging and dropping it onto Xcode's dock item) or select a different one in the General tab of the target editor.
  • TheWaterProgrammer
    TheWaterProgrammer almost 7 years
    how can get the name of my provisioning profile. I am sure it is installed in the machine I am trying to make this work. since on that machine I am able to build+sign the app using Xcode UI editor. Just doesn't work command line
  • Sven Driemecker
    Sven Driemecker almost 7 years
    1. Are you sure you want to build your project with Release configuration but Development Signing? Seems a little odd. You may want to switch to -configuration Debug or explicitely configure Distribution Cert and Profile. 2. Double Check that the configured Cert is really linked in the Prov Profile 3. You can look up the profile's name in the profile itself: open in any TextEditor and search for <key>Name</key> 4. You may have multiple Profiles with the same name installed at $HOME/Library/MobileDevice/Provisioning Profiles. Be sure that all profiles have a unique name
  • TheWaterProgrammer
    TheWaterProgrammer almost 7 years
    Please dont mind. I am a little new in understanding this. I am trying to sign my app for Release build. why do you call it a Development signing ? I am with PROVISIONING_PROFILE_SPECIFIER="iPhone Distribution: My Company (98U8AKJSDF)". Something like this. Its a long list of mobileprovisions in $HOME/Library/MobileDevice/Provisioning Profiles. Is it possible to get the PROVISIONING_PROFILE_SPECIFIER from a mobileprovision` if one of them is correct ?
  • Sven Driemecker
    Sven Driemecker almost 7 years
    No problem :) iOS Team Provisioning Profile ... always refers to a development profile, so this doesn't help in your case. You need a distribution profile to match your distribution cert and release config. Do a backup of $HOME/Library/MobileDevice/Provisioning Profiles, then clear the folder, then let the Xcode UI build your project with Release configuration. Xcode's automatic Code Signing should download the proper Profile for your. You can then use the profile's name as value for PROVISIONING_PROFILE_SPECIFIER
  • TheWaterProgrammer
    TheWaterProgrammer almost 7 years
    On Xcode UI IDE, if I drag & drop the provisioning profile in use then it makes a .mobileprovision. Is there some way to get the correct name of provisioning profile from the .mobileprovision ? And input that into this PROVISIONING_PROFILE_SPECIFIER with xcodebuild command ? Looks like I am able to open the .mobileprovision with TextEdit
  • TheWaterProgrammer
    TheWaterProgrammer almost 7 years
    Important question pls: Is there a way to pass the DEVELOPMENT_TEAM with xcodebuild command? Now its a different error. It says Select a development team in the build settings editor that matches the selected profile
  • Sven Driemecker
    Sven Driemecker almost 7 years
    You can override any buildsetting when calling xcodebuild, so you can of course do DEVELOPMENT_TEAM="ABCDEFGH" (should be 10 characters, see <key>com.apple.developer.team-identifier</key> in your prov profile)
  • TheWaterProgrammer
    TheWaterProgrammer almost 7 years
    A new error this time: Provisioning profile "iOS Team Provisioning Profile: com.myapp.something.something" is Xcode managed, but signing settings require a manually managed profile. Something to do with the provisioning profile ? thanks for the help until yet. Really appreciate
  • Sven Driemecker
    Sven Driemecker almost 7 years
    You're welcome. Like I said above, you can not use Team Provisioning Profiles for Manual Release Builds. You have to setup a dedicated Distribution Profile. Or let Xcode's Automatic Code Signing do this for you
  • TheWaterProgrammer
    TheWaterProgrammer almost 7 years
  • TheWaterProgrammer
    TheWaterProgrammer almost 7 years
    The dedicated distribution profile that you mentioned should be used with manual signing looks to be present in the system. I just need to know how to use it with xcodebuild command. Executing security find-identity -p codesigning -v | grep "$CODE_SIGN_IDENTITY" gives a list of 5 signing identities ones of them state as iPhone Distribution: My Company (SOME123ID). *So, can I use the distribution profile with xcodebuild manual signing. If yes, How can I get the actual ID to use with xcodebuild command?
  • Werner Altewischer
    Werner Altewischer over 5 years
    Is it possible to supply multiple profiles this way (in case you need to build app extensions more than one profile is required)?