Search code examples
iosxcodecode-signing

How to fix "Command /usr/bin/codesign failed with exit code 1" error


I am trying to code sign my first app but I can't get it to compile and it keeps giving me the Command /usr/bin/codesign failed with exit code 1 error

To code sign the app I followed the tutorial at this link:

https://ioscodesigning.com/generating-code-signing-files/

I've already checked my keychain for a duplicate certificate, cleared my Derived Data, and selected my provisioning profile in build settings. I don't quite understand Info.plists and bundles so it may be a problem with one of these, but I'm not sure.

I also tried the first answer below about the signing identity for the app. After I added my provisioning profiles, the error went from

CodeSign /Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Products/Debug-iphonesimulator/See\ and\ Say.app
    cd "/Users/myname/Desktop/See and Say"
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Signing Identity:     "-"

    /usr/bin/codesign --force --sign - --entitlements /Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Intermediates.noindex/See\ and\ Say.build/Debug-iphonesimulator/See\ and\ Say.build/See\ and\ Say.app.xcent --timestamp=none /Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Products/Debug-iphonesimulator/See\ and\ Say.app

/Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Products/Debug-iphonesimulator/See and Say.app: Is a directory
Command /usr/bin/codesign failed with exit code 1

to

CodeSign /Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Products/Debug-iphoneos/See\ and\ Say.app
    cd "/Users/myname/Desktop/See and Say"
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Signing Identity:     "iPhone Developer: Certificate Name (5DTU5WC6AS)"
Provisioning Profile: "Provisioning Profile Name"
                  (bc4a4413-f6da-4433-9525-59daf158ed15)

    /usr/bin/codesign --force --sign 1CC2A9F98E64BE37CA2AAFB31DD68558C185C72A --entitlements /Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Intermediates.noindex/See\ and\ Say.build/Debug-iphoneos/See\ and\ Say.build/See\ and\ Say.app.xcent --timestamp=none /Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Products/Debug-iphoneos/See\ and\ Say.app

/Users/myname/Library/Developer/Xcode/DerivedData/See_and_Say-eyscdjurjndlatcstdhogblpvxxb/Build/Products/Debug-iphoneos/See and Say.app: Is a directory
Command /usr/bin/codesign failed with exit code 1

Any ideas what the problem is?


Solution

  • Your issue is probably caused by the wrong signing identity you have selected

    Signing Identity: "-"

    Seems to be an invalid signing identity

    Try to select a valid signing identity on your project's signing settings:

    Target build settings -> Signing