[ios] command/usr/bin/codesign failed with exit code 1- code sign error

I'm currently in the process of submitting my first app to the Apple store. I've completed the following processes

  1. Obtained a developer account
  2. Logged into the Member Center to Create an App ID
  3. Used keychain access to request and receive a distribution certificate
  4. Obtained a provisioning profile using my id and certificate

When I build the app it runs perfectly in the app simulator and on the actual ipad, however when I switch my app to Archive on iOS Device i have a major code sign error which i've attached below.

codesign /Users/Gaby/Library/Developer/Xcode/DerivedData/RoyalAppInspection-dthvtpxadkslqmhkwdpaqkyujscg/Build/Products/Debug-iphoneos/RoyalAppInspection.app
cd /Users/Gaby/Desktop/RoyalAppInspection
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/bin:/bin:/usr/sbin:/sbin


/usr/bin/codesign --force --sign 79640A11C8D22589BD337496ABB8443581513846 --entitlements /Users/Gaby/Library/Developer/Xcode/DerivedData/RoyalAppInspection-dthvtpxadkslqmhkwdpaqkyujscg/Build/Intermediates/RoyalAppInspection.build/Debug-iphoneos/RoyalAppInspection.build/RoyalAppInspection.app.xcent /Users/Gaby/Library/Developer/Xcode/DerivedData/RoyalAppInspection-dthvtpxadkslqmhkwdpaqkyujscg/Build/Products/Debug-iphoneos/RoyalAppInspection.app

79640A11C8D22589BD337496ABB8443581513846: no identity found Command /usr/bin/codesign failed with exit code 1

I have no idea what to do to fix this, as I've tried to make sure all the other aspects of the process were completed correctly.

One concern i did have was when i clicked the provisioning profile file it would not open and "add to library" wouldn't pop up (i cannot access iphone configuration utility for some reason.) I manually added the .mobileprovision file to my xcode project but i'm thinking this may also be a source of my error.

Anyone, can you please help?

This question is related to ios objective-c xcode codesign xcode-archive

The answer is


I had the same error on January 2018 with xcode 8.2.1

Before I try to open xcode I couldn't because the system was updating. I tried sometime later and it let me working on it, and then I got the same error.

I followed most of the solutions described in this article but they didn't work for me.

Then I remembered the message about the system updating and I tried to reboot the machine.

And that did the magic. It worked for me.


For me following steps worked:

  1. Quit Xcode.
  2. Open Terminal.
  3. Typed Command xattr -rc /Users/manabkumarmal/Desktop/Projects/MyProjectHome
  4. Open Xcode.
  5. Cleaned.
  6. Now worked and No Error.

I have solved this problem, very easily.

  • Just reboot the computer ( it refreshes everything by itself ).

I hope this helps..


Open the project into the Xcode.
Select project.app file and right click on it, select “show in finder” option.
Open terminal and go to the project.app file path.

Type the following to commands one by one:

xattr -lr project.app
xattr -cr project.app

Open the project and run.


I recently had this issue and all above solutions didn't work for me.

The reason why it works on your simulator but not real devices is probably related to your Development Certificate.

So I revoked my certificate on Apple Developer Portal and request a new one on my computer. Here are the steps:

  1. Goto Apple Developer Portal and revoke your old (not working) development certificate. revoke
  2. Add iOS App Development Certificate add
  3. Follow the step on from Apple
  4. Download the newly generated certificate and add it (double click) to your Keychain download
  5. Make sure it is in your XCode Accounts accounts

Then it works!

Hope it helps!


Another reason you may see this error that I haven't seen posted yet, especially if you are using Jenkins, is that your certificate's private key needs "Allow all applications to access this item" selected.

  1. Open your Mac keychain
  2. Go to "Certificates" or "My Certificates" under "Category" on the left.
  3. Find the cert you're trying to sign with, and click the little grey triangle on the left of the certificate to reveal the associated private key.
  4. Left/ double-click the private key and select "Get Info."
  5. Toggle from "Attributes" to "Access control"
  6. Select "Allow all applications to access this item" and save changes.
    enter image description here I maintain a large cluster of Mac mini nodes as part of a centralized Jenkins CI system, and this can come up.

Rebooting didn't work for me.

Just try with downloading and adding the Certificate again to keyChain. That worked for me. When I checked Keychain Access the respective certificate was missing. Got the problem solve when I reinstalled the certificate.


Today, 2020 year, I've solved this problem with Xcode 11.7, Xcode 12.0 and Xcode 12.1 following these steps:

Identifying the bad certificate:

  • From you Keychains select Login
  • From Category select Certificates
  • Find any Apple Certificate that has the blue +
  • Double click on the certificate.
  • Expand the Trust

If it's messed up then the "When using this certificate" is set to "Always Trust" along with the blue +

Fixing the bad certificate:

  • Just set it to "Use System Defaults" and close it.
  • You'll get a pop up. Type in your password to update settings.
  • Close KeyChain.
  • Go back to your project, clean and run.

Problem should have gone away. If that didn't work then go back to Keychain and just double check and see if there are any other Apple certificates that are set to Always Trust and repeat the process.


I Followed all the things mentioned in this thread but still facing same issue-

/usr/bin/codesign --force --sign A7F8FCD694D7923A3E57826398C3380E2E5A5446 --entitlements  unknown error -1=ffffffffffffffff
Command /usr/bin/codesign failed with exit code 1

I have configured Automatic signing with my code base which will work with xcode run as well as xcodebuild run from terminal from my machine but it gives above error when I run it on jenkins pipeline or try to run on terminal from remotely connected machine

In my case Automatic signing is not working if access remotely. because I need to open keychain before archive using

security unlock-keychain -p "newpassword" "/Users/xyz/Library/Keychains/login.keychain"

keychain passwords & login password for macOS X user was different I change it to new same password and it works for me.


If nothing is working in @d4Rk solution Just use the below screen to delete unwanted/expired similar provision profiles. Right click on provision profile to move it to trash. provision profile window

Because in my case after doing all the steps I was still getting the same issue and it resolved when I deleted old expired provision profiles with same name and then using the correct one in build setting.


delete your certificate in your dev then Reinstall and it will working!


The following steps solved the problem for me. I was having the issue where it was not compiling for the device or archiving, working fine for simulator.

  1. Open keychain access.
  2. Lock the 'login' keychain.
  3. Unlock it.

Clean and build after doing the above steps and everything works fine now.


Just reset your development and distribution certificate and clean your project. After that , Reboot also worked for me. Interestingly it seems to be an issue with allowing Xcode access to the certificates. When i tried the archive again, i received 2 popups asking me if i wanted to allow Xcode to access my keychain. After this it worked fine.


I was having the issue after select the deny when it asks for permission

After some search I got it fixed by restarting the system.


Remove the existing precompiled files:

rm -rf  /Users/raghu/Library/Developer/Xcode/DerivedData/Solitare-fdaukpanamlzllacxvdzfbeqcrsg/

And try to build it again.


Reboot also worked for me. Interestingly it seems to be an issue with allowing Xcode access to the certificates. When i tried the archive again, i received 2 popups asking me if i wanted to allow Xcode to access my keychain. After this it worked fine.


I had this error in Xcode 8 and Mac OS Sierra. Tried all the above solutions and none worked. This was the only one that worked for me. Open terminal, and type this in:

cd ~/Library/Developer/Xcode/DerivedData
xattr -c *

For me "Restarting Mac System" got worked


For me, i just cleaned the app and it worked (cmd + shift + k), removing the error. I got the error after updating to swift 2.3.


Do everything d4Rk suggests, that is a great walk-through. if it still isn't signing, you might have some expired or revoked certificates. I find this can happen when you're working on a team.

  1. quit xcode.
  2. open Keychain Access.
  3. in the 'Certificates' section, go through all "iPhone Distribution" certificates and if they're expired or revoked or otherwise invalid, delete them.
  4. same as 3, but for the 'My Certificates' section.
  5. re-open xcode and try again.

In my situation, some pods were out of date after I updated my OS. Here's what fixed it:

In terminal:

cd /Users/quaisafzali/Desktop/AppFolder/Application/
pod install

Then, open your project in Xcode and Clean it (Cmd+Shift+K), then Build/Run.

This worked for me, hope it helps some of you!


I have Solved This Problem. If your project has .xcdatamodeld file (mean you are using coreData) then make sure the entities you formed go its Data Model Inspector and check Class has codegen, manual/None or classdefination. if it is class defination then make it manual/None and clean the project and run again. screenshots are given below:

enter image description here

enter image description here


This worked for me. Give it a try:

cd ~/Library/Developer/Xcode/DerivedData
xattr -rc .

Rebooting worked for me too. After upgrading to High Sierra I got tons of problems with password and it looks like I needed to enter the Password for the Keychain access to XCode.


The easy way (which will do all png files) I used:

Run This Command in Terminal

find . -name "*.png" -exec xattr -c {} \;

Examples related to ios

Adding a UISegmentedControl to UITableView Crop image to specified size and picture location Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods Keep placeholder text in UITextField on input in IOS Accessing AppDelegate from framework? Autoresize View When SubViews are Added Warp \ bend effect on a UIView? Speech input for visually impaired users without the need to tap the screen make UITableViewCell selectable only while editing Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

Examples related to objective-c

Adding a UISegmentedControl to UITableView Keep placeholder text in UITextField on input in IOS Accessing AppDelegate from framework? Warp \ bend effect on a UIView? Use NSInteger as array index Detect if the device is iPhone X Linker Command failed with exit code 1 (use -v to see invocation), Xcode 8, Swift 3 ITSAppUsesNonExemptEncryption export compliance while internal testing? How to enable back/left swipe gesture in UINavigationController after setting leftBarButtonItem? Change status bar text color to light in iOS 9 with Objective-C

Examples related to xcode

Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64 iPhone is not available. Please reconnect the device Make a VStack fill the width of the screen in SwiftUI error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65 The iOS Simulator deployment targets is set to 7.0, but the range of supported deployment target version for this platform is 8.0 to 12.1 Xcode 10.2.1 Command PhaseScriptExecution failed with a nonzero exit code Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Xcode 10: A valid provisioning profile for this executable was not found Xcode 10, Command CodeSign failed with a nonzero exit code

Examples related to codesign

Codesign wants to access key "access" in your keychain, I put in my login password but keeps asking me command/usr/bin/codesign failed with exit code 1- code sign error missing private key in the distribution certificate on keychain Re-sign IPA (iPhone) Command /usr/bin/codesign failed with exit code 1 Codesign error: Provisioning profile cannot be found after deleting expired profile

Examples related to xcode-archive

command/usr/bin/codesign failed with exit code 1- code sign error