Xcode 11, Command CodeSign failed with a nonzero exit code

Ever since updating (against my will) to Xcode 11, I'm getting this error when I try to build my project:

"Command CodeSign failed with a nonzero exit code"

I've tried cleaning my project, resetting my login keychain, and restarting my computer, but I still get this error... what to do?


Post not yet marked as solved Up vote post of Jack K Down vote post of Jack K
56k views

Replies

Are you by any chance using flutter and the flutter run command to perform the build? If so, does clicking the build/run button in Xcode work?


If this is the situation you are running into, there is an open ticket over at Github raising this issue. The problem appears to be in ios-deploy not working on the latest version of Xcode that we were forced to upgrade to.


I just bought a new Mac and iPhone and ran into this issue. No fix yet other than to remotely log into the machine and push the button in Xcode.


Please let know if you are in fact using Flutter and if clicking the run button in Xocde fixed your issue also, because then it confirms to me that there are at least 3 people with the exact same issue so far.

Same issue here and apple has offered no help. EVERY time they upgrade something it breaks something in my development process, very frustrating.

i'm having the same issue. i had the issue before but only when adding or modifying png files to my project folder. the fix was to xattr -cr the build folder and it would compile again.


but now this happens every single time and the xattr doesn't work on my current project and i can't build anything.

  • I had the same issue and discovered that my .png file had a Photoshop extended-attribute attached, that did not go down well with xcode. The weirdest thing is that the project compiled for years, and this issue only appeared RIGHT AFTER I updated a pod and tried to recompile. It took me forever to figure out what was causing it as all my attention was on that pod (which turns out, was irrelevant).

    Anyway, what worked for me was to strip the extended attributes off the .png file before adding it to the Xcode project. Using the command line would have worked, but I happened to have "xattred" on my machine. It's a free OSX app that can display / add / delete extended attributes from files / folders.

  • From the bottom of my heart, thank you! I just ran-up against this on code that had compiled just last night but, after adding a file that had a Photoshop filter applied to a subimage, didn't. Your comment saved me a lot of time. So, again, thanks!

  • Same here. I just needed a small png file for testing so I created one with Photoshop 2022. Suddenly, the build fails with this message. Now I used an online generator to create that png and it suddenly works. Thank you so much.

Add a Comment

same here...


all apples older example code are USELESS with xcode 11 due to failed code signing...


VISTA has come to macOS

having the same issue. it ain't me.

Restarting the OS solved this for me

  • Restarting my Mac also solved this issue for me. Using Xcode 13.2.1. Had just updated to macOS 12.1.

Add a Comment

not for me.

the app actually compiles and runs in the OS.

This is a BUG in XCode.

Post not yet marked as solved Up vote reply of eblu Down vote reply of eblu
  • It was for me the same. When I changed the selected device as an android device in android studio I could run the app. But XCode doesn't work properly. I hope that bug would be fixed (even in 3 years still haven't solved)

Add a Comment
What worked for me is to delele image files which were added in 'SceneKitAssetCatalog.scnassets' folder. I think only 3D objects formats like usdz, scn, obj etc are allowed in 'SceneKitAssetCatalog.scnassets' folder.
And moved the images which were required to be applied as texture to 3D scn object in a separate folder.


I got the same warning"command codesign failed with a nonzero exit code"

my project can not run on Simulator but totally ok on my real machine.

I tried " product -> Clean Build Folder". And it looks working for me.(OOPS, Just realized you said did it too and not working for you. rip.)


For me this was after adding a .png file to an existing .scn assets folder, plus also a .wav file.

I searched and searched for multiple reasons and found that Xcode, owing to increased security, doesn't like extensions on files, I deleted the files and the project rebuilt fine, I then used terminal to 'cd' into the files in question directly and removed their extensions using the 'xattr' command in Terminal

To Remove All Extended Attributes On a Single File

Use xattr with the -c flag to "clear" the attributes:
xattr -c yourfile.txt

To Remove All Extended Attributes On Many Files

To recursively remove extended attributes on all files in a directory, combine the -c "clear" flag with the -r recursive flag:
xattr -rc /path/to/directory

this link is useful also for some other fixes and more detail...
https://stackoverflow.com/questions/4833052/how-do-i-remove-the-extended-attributes-on-a-file-in-mac-os-x
  • I got this message after adding a .png file saved from Paintbrush to my project. A png downloaded from the internet was fine. xattr -c filename fixed the problem for me.

  • Literally took my hours trying to fix this problem, until I found this post. Added some .png files to the project and started getting this error. Running xattr -c fixed it. I am really ****** of lack of information for this error.

Add a Comment
Happening to me on 12.2. I was saving project on cloud. Moved to local disk and it compiles now
kedar619 who I wish I could thank actually brought up a very important solution which is with those who use Scenekit. If you have non-3D files inside the now called art.scnassets folder, there is a good chance your project won't compile. I went looking all over the place for solutions to the Command CodeSign error problem, and then when I checked my assets folder I found iCloud duplications in there, so when I deleted them the project finally built successfully.
Thanks all, I run: xattr -cr /Users/j...... Products/Debug-maccatalyst/ on Terminal and worked !!!.
Support to developers from Apple very improvable ....

描述文件对应的证书应该是299MFJ63GP,实际上Xcode配置错误,手动将project文件中8JQ353ME6X的id删除,重新保存后运行,一切正常。

For those who tried all solutions without any success, try to download and install the latest certificate from this link: https://www.apple.com/certificateauthority/AppleWWDRCAG3.cer

This solved my issue!

  • Thanks! This worked for me.

  • ^^^

  • Thanks. I was also missing the newer version of this root.