[iphone] /usr/bin/codesign failed with exit code 1

I am attempting to deploy my first development iPhone app, and am running into some problems. I have successfully went though the online Provisioning Assistant, but now I am stuck. No matter what I do, I always get the following error.

/usr/bin/codesign failed with exit code 1

Anyone have any ideas why this is happening?

This question is related to iphone ios xcode deployment code-signing

The answer is


What worked for me was adding --deep to Other Code Signing Flags in Build Settings. More information here: Codesign of Dropbox API fails in Xcode 4.6.3: "code object is not signed at all"

Unfortunate that this ambiguous error condition has 400 different solutions, but I digress.


I just came across this error, and here's what I found out in case this helps anyone: I discovered that you can right click the error message in Xcode and choose expand to get more details, including a description of the problem.

In my case, I had two copies of my developer certificate with the same name in different keychain files, and Xcode couldn't figure out which one to use.


It might be strange answer for codesign issue in Xcode 9.0. I was receiving this error too and did not know what to be done, because everything was correct.

I went to the keychain, I had the login option "unlocked". I locked it and compiled my build again. Xcode itself asked me to open access keychain. I gave access and it worked.

Steps were:

  1. Go to keychain
  2. Lock it
  3. Archive the code, build the project again

Throwing my comments into the ring, I just came across this after attempting to refresh my development environment after clicking DENY accidentally on one of the application requests, after searching around I found a number of things that didn't seem to work. This is the full order in which I've attempted the fixes and whether there was a success:

1) Attempted to clear the DerivedFiles and restart XCode - no dice

2) Attempted to Log and Unlock the Keychain, then restart XCode - no dice

3) Attempted to refresh my developer account within XCode - no dice

4) Bit the bullet and just reset my entire keychain, after doing so my developer account was signed out (signed back in), then restarted XCode - no dice

5) Found an article on here that said that we needed to set the [login|local|System]/certificate/Apple Worldwide Developer Relations Certificate Authority to "System default". But in my case it was already set to system default - no dice

6) Then I looked at my actual developer certificate login/my certificates/Mac Developer: and when I looked in there it was correctly set to Confirm before allowing access BUT there was no entries in the lower section. There should be [Xcode, codesign, productbuild]. I deleted the certificate entry and restarted XCode - bingo

The certificate was added and I was then prompted. So what did I do, I pressed "always allow" and then just boned myself.

I had to go back and delete the certificate again, then go through about 20 allow dialogs during a clean build. Once completed, I was able to build completely.


One thing that you'll want to watch out for (it's a stupid mistake on my part, but it happens), is that the email address attached to the CSR needs to be the same as the email connected to your Apple Dev account. Once I used a new CSR and rebuilt all the certs and provisioning profiles, all was well in applesville.


Open the project path in terminal and enter the below commands in terminal

1) find . | xargs -0 xattr -c

2) xattr -rc .

This works for me.


after hours of googling and trying out different things, this is what fixed it for me:

  1. Make sure there are no certificates in the System > Certificates tab on Keychain Access. Remove all duplicate certificates from there.

  2. Install the WWDR intermediate certificate under certificates from the provisioning portal, in addition to the developers certificates and make sure you see it in the Login > Certificates tab on Keychain Access.

hope this helps some of you!


I was also getting this error ("/usr/bin/codesign failed with exit code 1"), and when I looked in Keychain Access my developer certificates were marked as "This certificate was signed by an unknown authority". I had recently upgraded to Mac OS 10.8 and have had a couple of other XCode (4.5.2) issues since then. It turns out I did not have the WWDR intermediate certificate installed. I downloaded that from the iOS Provisioning Portal, installed that in Keychain Access, and my project builds again!


I had the exact same error, and tried everything under the sun, including what was elsewhere on this page, with no success. What the problem was for me was that in Keychain Access, the actual Apple WWDR certificate was marked as "Always Trust". It needed to be "System Defaults". That goes for your Development and Distribution certificates, too. If any of them are incorrectly set to "Always Trust", that can apparently cause this problem.

So, in Keychain Access, click on the Apple Worldwide Developer Relations Certificate Authority certificate, select Get Info. Then, expand the Trust settings, and for the combo box for "When using this certificate:", choose "System Defaults".

Others have commented that you may have to do this in System and login keychains for these errors.


I just came across this error and it was because I was trying to write the build file to a network drive that was not working. Tried again from my desktop and it worked just fine. (You may have to "Clean" the build after you move it. Just choose "Clean all Targets" from the "Build" drop-down menu).

Tobias is correct though, dig into the details on the code by right-clicking it to see what your specific problem is.


I had the same problem the distribution build. It just happened all of sudden. In fact I did not have this problem a few days ago and I had my Ad-Hoc version compile right. This issue came up because my certificate just expired today. So I went create a new provisional following Apple's guidance: (http://developer.apple.com/ios/manage/distribution/index.action).

After spending hours on the net and made sure I had not fallen for what could go wrong. Here is what save me as suggested by Tobias and Dan Ray:

  1. "...discovered that you can right click the error message in Xcode to view details".
  2. "...the issue was an expired certificate on my System keychain. Keychain Access doesn't, by default, show expired certs".

The detailed information told me about ambiguous matching two certificates. One of them happened to be an expired certificate in the System key chain. So I deleted the expired one then it worked! I also had a concern about what to enter in the "common name" when create the distribution certificate using the keychain utility: my name or my company name. In my case, I entered my name. I am guessing it is the same as the title that addressed by the developer's auto responder email.

Great help. Thanks.


Another reason, Check your Developer account is connected with xCode

enter image description here


I had the same unknown error from codesigning that you mentioned. Similar to the answer provided (but a little different), I just locked my keychain access and unlocked it, and I was able to build and run to my device again. If anyone has the same issue, perhaps try that first before going through the trouble of modifying the keychain password.


When I got this error I wasn't even trying to sign the app. I was writing a test app and didn't care about signing. In order to get rid of this message I had to select "Don't Code Sign" from Build Settings under Code Signing.

enter image description here


In My Case, after a fews days of research,

All I did to revolve is listed below:

  1. delete all the certificate on your keychain.
  2. goto your apple account. a) download the specify certificate your want to install on your keychain. b)(Optional) Also create and download the require profile.
  3. in Xcode, clean your project. This may take some time.
  4. Build your project.

This should work for similar codesign issues.

Note, during this process the OS would ask for your credential validation.


Kinda old question, but still happens it seems. Another solution:

Occurred for me after reverting a branch in git. Tried cleaning, cleaning builds, deleting derived and restarting Xcode, but no luck.

Try rebooting the comp.


In my case error was due to the fact that I had two keys on the keychain with the same name. I deleted the old one and that solved the issue.

Going to the detail message show the real problem to me.


Sometimes your build folder simply needs cleaning - it certainly worked for me. Thanks to loafer-project for the solution.


If the error immediately preceding the codesign error says something like 'resource fork, Finder information, or similar detritus not allowed'

Then navigate to the .app file in Terminal and type:

xattr -cr < path_to_app_bundle >

ref: https://developer.apple.com/library/content/qa/qa1940/_index.html


I had the same problem but also listed in the error log was this: CSSMERR_TP_CERT_NOT_VALID_YET

Looking at the certificate in KeyChain showed a similar message. The problem was due to my Mac's system clock being set incorrectly. As soon as I set the correct region/time, the certificate was marked as valid and I could build and run my app on the iPhone


Same issue with ambiguous (matches "iPhone Developer: [me] " and /// tweetdeck's library privatedata file. Fixed it by moving file to the trash and re-logging into Tweetdeck, setting up passwords again. What a pain.


One possible cause is that you doesn't have permission to write on the build directory.

Solution: Delete all build directory on your project folder and rebuild your application.


There could be a lot of reason when you get this kind of error:

  1. Check whether you have selected a provisioning profile which includes the valid Code Signing Identity and a valid Bundle Identifier in Settings. (Goto Build Settings->Signing->Provisioning Profile).

  2. Open Keychain Access and click on lock icon at top left, so it will lock the login keychain and then again click to unlock.

enter image description here

  1. Goto File->Project Settings->Derived Data and delete your project build folder. After that clean and build your app.

I had the same problem. In the end it turned out that my private key did not allow codesign to access it. One can see this in the info dialog in keychain application.


I have to agree with Tobias. The error is too generic. When the same thing happened to me I dug into the error message and realized I'd screwed up something in the build properties, but not the code signing. So yeah, I'd dig in to the details.


Examples related to iphone

Detect if the device is iPhone X Xcode 8 shows error that provisioning profile doesn't include signing certificate Access files in /var/mobile/Containers/Data/Application without jailbreaking iPhone Certificate has either expired or has been revoked Missing Compliance in Status when I add built for internal testing in Test Flight.How to solve? cordova run with ios error .. Error code 65 for command: xcodebuild with args: "Could not find Developer Disk Image" Reason: no suitable image found iPad Multitasking support requires these orientations How to insert new cell into UITableView in Swift

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 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 deployment

error: This is probably not a problem with npm. There is likely additional logging output above Deploying Maven project throws java.util.zip.ZipException: invalid LOC header (bad signature) repository element was not specified in the POM inside distributionManagement element or in -DaltDep loymentRepository=id::layout::url parameter "Untrusted App Developer" message when installing enterprise iOS Application How do I copy directories recursively with gulp? How to deploy correctly when using Composer's develop / production switch? Enterprise app deployment doesn't work on iOS 7.1 Can not deserialize instance of java.lang.String out of START_OBJECT token Run command on the Ansible host Error when deploying an artifact in Nexus

Examples related to code-signing

Xcode error: Code signing is required for product type 'Application' in SDK 'iOS 10.0' Code signing is required for product type 'Application' in SDK 'iOS 10.0' - StickerPackExtension requires a development team error Xcode 7 error: "Missing iOS Distribution signing identity for ..." The executable gets signed with invalid entitlements in Xcode iOS 7.0 No code signing identities found “Unable to find manifest signing certificate in the certificate store” - even when add new key Code signing is required for product type 'Application' in SDK 'iOS5.1' Why is my locally-created script not allowed to run under the RemoteSigned execution policy? The entitlements specified...profile. (0xE8008016). Error iOS 4.2 Xcode 'CodeSign error: code signing is required'