Aymeric Pitre
Aymeric Pitre

Reputation: 131

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

I have recently made the update of mac OS from 10.11 to 10.12 and i can't signing my iOS applications in Xcode 8.0 anymore.

I get this error :

CodeSign /Users/aymericpitre/Library/Developer/Xcode/DerivedData/OrpiDirect-ghphwnhfbtdulhgauptikzmsrqdi/Build/Products/Debug-iphoneos/OrpiDirect.app

cd /Users/aymericpitre/Documents/projets/Ville-de-lyon-iPhone/VilleDelyon_git/ville_de_lyon

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: aymeric xxxx (SYC4JR6K8G)"
Provisioning Profile: "VDL-sierra"
                      (756b4f3a-26aa-4937-ba40-4cc4eea03e92)

/usr/bin/codesign --force --sign D60599B3AE74EE1D4863C249026FA28545A07689 --entitlements /Users/aymeric/Library/Developer/Xcode/DerivedData/OrpiDirect-ghphwnhfbtdulhgauptikzmsrqdi/Build/Intermediates/OrpiDirect.build/Debug-iphoneos/OrpiDirect.build/OrpiDirect.app.xcent --timestamp=none /Users/aymeric/Library/Developer/Xcode/DerivedData/OrpiDirect-ghphwnhfbtdulhgauptikzmsrqdi/Build/Products/Debug-iphoneos/OrpiDirect.app

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

The provisioning profile seems to be ok because i find it in the Xcode/preferences/accounts window.

I've tried to run xattr -c * command inside derived folder but it doesn't work.

Upvotes: 13

Views: 2280

Answers (5)

user3877214
user3877214

Reputation: 311

I deleted a key named "1" in keychain access.

Then xcode has become to work!

Upvotes: 0

Alex R. R.
Alex R. R.

Reputation: 2992

I finally make it work. After digging into the internal logs, I realized that the problem came from the keychain. I tried to delete all the entries with the GUI, but one couldn't be deleted (named "1")

So I had to delete all the keychain folder:

rm -rf /Users/my_user/Library/Keychains

Rebooted the mac, installed keys again, and everything worked as expected.

Disclaimer: First make a backup of all the needed keys! (export before delete) For any service like Chrome sign-in, you will need to enter your credentials again

Upvotes: 3

Paul T.
Paul T.

Reputation: 5038

Xcode 8 allows you automatic signing. You need to select your target in settings -> General. And you will see the checkbox like on the image:

enter image description here

When you check this checkbox, you will need to choose your team (like in red rectangle on the image). After that Xcode will create a team provision profile for your application, and your application will be signed automatically.

P.S. I you don't see your team in the team dropbox like on the image, you need to Xcode -> Preferencies:

enter image description here

After that you need to enter "Accounts" tab -> tap + button:

enter image description here

After that you the team with your developer account will appear in the Team dropbox like on the 1st image.

Upvotes: 0

Habib Ali
Habib Ali

Reputation: 280

I have a very dreadful answer of this. I dont know what was corrupted in my system but after so many reinstallation and deletion of xcode still didn't solve the issue. So I formatted my hdd and reinstall mac OS Sierra and xcode 8 and that solved the issue

Upvotes: 2

Wiffzack
Wiffzack

Reputation: 345

Try under Window tab => Organizer, the provisioning that are in your device. Then re-add them (download them again on the apple website). And try to compile again.

Upvotes: 1

Related Questions