10

I'm using Xcode 6.1, OS X Yosemite preview 8, and I'm getting the following error on code signing my app:

Command /usr/bin/codesign failed with exit code 1

Reading on Google, it seems to be linked to expired certificates/provisioning profiles. I deleted all of my certificates & profiles, created a new development certificate & profile, installed both, restarted my Mac, and I’m still getting the same error.

Can anyone shed some light on how to resolve this problem?

alexwlchan
  • 5,699
  • 7
  • 38
  • 49
scb998
  • 899
  • 5
  • 18
  • 42
  • 2
    How about this: Try Xcode -> Preferences -> Accounts -> Choose your account, and then View Details -> Refresh (button on bottom left), Refresh again, restart XCode. Sounds like voodoo but it works for me and my team! – LMVogel Sep 24 '14 at 07:32
  • @LMVogel unfortunately that didn't work for me - but I'm glad it worked for someone... – scb998 Sep 25 '14 at 01:28
  • So I've managed to fix the issue for my particular case - in the build settings, instead of automatically detecting the certificate & provisioning profile to use, i manually set them - and it works. – scb998 Sep 25 '14 at 01:36

8 Answers8

35

How about this: Try Xcode -> Preferences -> Accounts -> Choose your account, and then View Details -> Refresh (button on bottom left), Refresh again, restart XCode. Sounds like voodoo but it works for me and my team! (Posting it as answer, because it DOES work, at least sometimes and for some people. Possibly related to the weather ;) )

LMVogel
  • 779
  • 7
  • 28
  • 4
    OMG, it worked for me. Thank you for not being afraid to post Voodoo. – Nancy Nov 06 '14 at 20:54
  • 1
    Wow after a huge battle with xcode (seems weekly) this worked. something to mention is my developer cert expired so i had to get a new one add it then delete the old THEN I got this error came here and this fixed it xcode 6.1 osx 10.10 – TouchMint Dec 06 '14 at 04:51
  • 3
    IT WORKED. WHY IS THIS PROCESS SO RIDICULOUSLY COMPLICATED? – temporary_user_name Feb 12 '15 at 23:04
  • I tried this several times and it wasn't working for me, but then I cleaned my project and it magically started working. So if this doesn't work for you on the first try, try running `clean` and `clean build folder`. – bmueller Jul 28 '15 at 00:04
  • @Kishorekumar - now there is a "Download All" which seems to do the trick – LMVogel Nov 03 '15 at 08:23
  • oh ok bro..why this problem occurs @LMVogel – Kishore kumar Nov 03 '15 at 08:55
  • @Kishorekumar - XCode madness. One has to offer gifts to the XCode gods, usually in form of restarting things :) – LMVogel Nov 03 '15 at 10:47
  • still right on Xcode 7.3.1 and OSX: 10.11.6 with "Download All" button – lee Aug 03 '16 at 12:05
2

as of Xcode 6.3.2, here's what I did. from main project view, click on build settings and in the search bar type in certificate, a code signing tab should pop up, I chose "dont sign code". and it worked

C. Greene
  • 251
  • 3
  • 15
1

So I've managed to fix the issue for my particular case - in the build settings, instead of automatically detecting the certificate & provisioning profile to use, I manually set them - and it works.

scb998
  • 899
  • 5
  • 18
  • 42
1

In my case I was getting this error while trying to build a project I downloaded from Github for my own personal use. I just went to the build settings and told it not to sign the code.

Keith
  • 141
  • 2
  • 5
1

Another gotcha I noticed is that codesign will fail if run from an ordinary ssh login session. It has to be run on a MacOSX desktop GUI shell window. This catches me every time, so I've added a line to the build script to print a message about running the script on the MacOSX GUI if codesign fails.

0

Delete previous provisional profile and add new provisional profile.restart the machine if still its giving an error like above. when your machine shut off then automatically your device asking for permission then select Confirm and run your code....its working.

Sarat Patel
  • 856
  • 13
  • 32
0

There appears to be a bug in XCode (I'm using 7.1.1) with returning to "Signing: None" after having attempted to sign with an expired identity, resulting in this codesign error even after you've apparently removed the bad signing identity.

The project.pbxproj file retains TargetAttributes for the expired identity, and Debug and Release settings both continue to show the following instead of the original empty values:

"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer";

This persists after cmd+alt+shift+K and closing XCode. I fixed it with a git reset (if I hadn't committed before attempting to sign, I'm not sure how I would have found this).

Jacob Rose
  • 430
  • 4
  • 6
0

I had to delete all my developer certificates from Keychain Access first, then use the Preferences -> Accounts -> View Details -> Download All approach to successfully re-sign my code.

Dave Cole
  • 2,446
  • 2
  • 20
  • 26