# Command CodeSign failed with a nonzero exit code

**URL:** <https://forum.ionicframework.com/t/command-codesign-failed-with-a-nonzero-exit-code/169641>\
**Category:** Ionic Framework\
**Created:** [July 25, 2019, 12:02pm UTC](https://forum.ionicframework.com/t/command-codesign-failed-with-a-nonzero-exit-code/169641 "2019-07-25T12:02:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![osrl](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/osrl/32/127290_2.png) [@osrl](https://forum.ionicframework.com/u/osrl)\
**Post date:** [July 25, 2019, 12:02pm UTC](https://forum.ionicframework.com/t/command-codesign-failed-with-a-nonzero-exit-code/169641/1 "2019-07-25T12:02:37Z")

</div>

I’m running this command and it fails.

ionic cordova compile ios --no-interactive --release --device --prod – --packageType=app-store --developmentTeam=\*\*\*\* --provisioningProfile=\*\*\*

There is a very long error message but here is how it ends. It’s not saying much but there is a problem about code signing.

```auto
CodeSign /var/root/Library/Developer/Xcode/DerivedData/MyApp-ccztmzoxngbmurbvfmxpessvdbbf/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app (in target: MyApp)
    cd /Users/xcloud/workspace/DCIOSApp_DummApp/platforms/ios
    export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity: "iPhone Distribution: ****"
Provisioning Profile: "match AppStore ***"
                      ( **** )

    /usr/bin/codesign --force --sign D4DC6C722544727A58C7449A285185812CAD815E --entitlements /var/root/Library/Developer/Xcode/DerivedData/MyApp-ccztmzoxngbmurbvfmxpessvdbbf/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Release-iphoneos/MyApp.build/MyApp.app.xcent /var/root/Library/Developer/Xcode/DerivedData/MyApp-ccztmzoxngbmurbvfmxpessvdbbf/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app
/var/root/Library/Developer/Xcode/DerivedData/MyApp-ccztmzoxngbmurbvfmxpessvdbbf/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app: errSecInternalComponent
Command CodeSign failed with a nonzero exit code

**ARCHIVE FAILED**

The following build commands failed:
        CodeSign /var/root/Library/Developer/Xcode/DerivedData/MyApp-ccztmzoxngbmurbvfmxpessvdbbf/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/InstallationBuildProductsLocation/Applications/MyApp.app
(1 failure)
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.

        cordova compile ios --release --device --packageType=app-store --developmentTeam... exited with exit code 65.

```

I’m actally using fastlane to build and release the app. Fastlane ionic plugin is creating that command. If I can’t solve this error, I want to try to create the .xcarchive file so I can use fastlane to build the ipa after that.

Can you help me?

---

<div class="post-metadata">

**Author:** ![sbelinchon](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@sbelinchon](https://forum.ionicframework.com/u/sbelinchon)\
**Post date:** [March 24, 2020, 3:35pm UTC](https://forum.ionicframework.com/t/command-codesign-failed-with-a-nonzero-exit-code/169641/2 "2020-03-24T15:35:10Z")

</div>

Did you find a solution?

---

<div class="post-metadata">

**Author:** ![alitalaee](https://avatars.discourse-cdn.com/v4/letter/a/c5a1d2/32.png) [@alitalaee](https://forum.ionicframework.com/u/alitalaee)\
**Post date:** [November 6, 2021, 2:41pm UTC](https://forum.ionicframework.com/t/command-codesign-failed-with-a-nonzero-exit-code/169641/3 "2021-11-06T14:41:58Z")

</div>

> [@osrl](#):
>
> ` cd /Users/xcloud/workspace/DCIOSApp_DummApp/platforms/ios`

Hello dear I had the same issue and tried many way to fix that but does not work. after that i realized the issue show the solve too. For me it solved after do like below image

1- Do as i mentioned in image

 ![Screen Shot 1400-08-15 at 17.49.02](https://global.discourse-cdn.com/ionicframework/original/3X/1/8/188866510bc905e3e5e5af7082c3c38d9917f832.png)

2- and then try to add profile developer again

 ![WhatsApp Image 2021-11-06 at 18.09.36](https://global.discourse-cdn.com/ionicframework/original/3X/1/c/1c3c6db630b38802077cea73af999014428c73d9.jpeg)

For you it can solve with  
1- cd /Users/xcloud/workspace/DCIOSApp\_DummApp/platforms/ios  
2-export CODESIGN\_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign\_allocate  
3- readd profiles

it is worked for me i hope it can help you too
