13

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

CodeSign /Volumes/HDD/OpenFrameworks/of_v0.9.8_osx_release/apps/plus-pool-light/pplight-ofx-098/bin/pplight-ofx-098Debug.app (in target 'pplight-ofx-098' from project 'pplight-ofx-098')
cd /Volumes/HDD/OpenFrameworks/of_v0.9.8_osx_release/apps/plus-pool-light/pplight-ofx-098
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate

Signing Identity:     "-"


 /usr/bin/codesign --force --sign - --entitlements /Volumes/HDD/OpenFrameworks/of_v0.9.8_osx_release/apps/plus-pool-light/pplight-ofx-098/build/pplight-ofx-098.build/Debug/pplight-ofx-098.build/pplight-ofx-098Debug.app.xcent --timestamp=none /Volumes/HDD/OpenFrameworks/of_v0.9.8_osx_release/apps/plus-pool-light/pplight-ofx-098/bin/pplight-ofx-098Debug.app

/Volumes/HDD/OpenFrameworks/of_v0.9.8_osx_release/apps/plus-pool-light/pplight-ofx-098/bin/pplight-ofx-098Debug.app: code object is not signed at all
In subcomponent: /Volumes/HDD/OpenFrameworks/of_v0.9.8_osx_release/apps/plus-pool-light/pplight-ofx-098/bin/pplight-ofx-098Debug.app/Contents/Frameworks/GLUT.framework
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?

I am building an OSX App using OpenFrameworks, not an iOS App. When I build it in Xcode 10.3 works fine with no errors.

The parts of this question that are unique is that this is for Xcode 11, not 10, and none of the answers for that other question worked for me!

JackKalish
  • 1,555
  • 2
  • 15
  • 24
  • Possible duplicate of [Xcode 10, Command CodeSign failed with a nonzero exit code](https://stackoverflow.com/questions/52421999/xcode-10-command-codesign-failed-with-a-nonzero-exit-code) – Desdenova Oct 02 '19 at 06:01
  • This is not a duplicate, because the other question was pertaining to Xcode 10, this is Xcode 11 – JackKalish Oct 02 '19 at 06:02
  • 1
    It is. Try those answers, error is the same signing error. – Desdenova Oct 02 '19 at 06:03
  • I tried all those answers, none of them worked. I was not having this error before updating to Xcode 11, that's why I see this as a new and different error. – JackKalish Oct 02 '19 at 06:04
  • "Command CodeSign failed with a nonzero exit code" is not enough information. What other errors are shown if you open the Build Log and select the lined-icon on the right of the codesign invocation line? – trojanfoe Oct 02 '19 at 06:32
  • OK, so you can see that `codesign` is choking when signing `GLUT.framework`. I *think* that can be solved by using the `--deep` flag. Edit your Build Settings and add `--deep` to the *Other CodeSign Flags* (or something like that). – trojanfoe Oct 02 '19 at 06:43

9 Answers9

15

You can get this error if you have added a folder to your project as a 'folder reference' (the project will have a blue folder logo in Xcode)

  • Remove the folder (Trash)
  • Add folder and select 'Create Groups' instead of 'Folder Reference' at the dialog Add Folder Dialog
13

I've resolved the same exact problem by:

  1. Add --deep to the "Other Code Signing Flags" in the "Build Settings".
  2. In the "Signing & Capabilities" of your target click on "+ Capability" in the top left corner and choose "Hardened Runtime".
  3. Then turn on "Disable Library Validation" in the list.

I don't really know if there's any drawbacks by using this capability, however my application compiles and works fine both on macOS and iOS.

SleepySquash
  • 361
  • 2
  • 5
7

I got the same error after I upgraded to XCode-11 this morning. Builds in the simulator but not on device.

This thread helped fix the issue which I summarized below.

https://stackoverflow.com/a/52628909/9286768

  • Open keychain access.
  • Lock the 'login' keychain. (right clicking on "login" in the upper left panel)
  • Unlock it, enter your PC account password.
  • Clean Project in the product menu.
  • Build it Again.
NathanNovak
  • 105
  • 1
  • 4
7

I fixed this by adding --deep to Other Code Signing Flags in the Build Settings > Signing

MrPickles2009
  • 117
  • 4
  • 10
  • 1
    I am running Xcode 11.4.1 (not beta) with the Mac Catalyst option turned on. Unfortunately, I still get the original error with and without --deep. – Michelle Jul 21 '20 at 00:48
  • This worked for me. Then a couple days later the problem came back. Restarted my Mac and it worked again. – Eric Soyke Sep 15 '22 at 15:20
  • I just had the same. I added '--deep', but still didn't work, then restarted my Mac and it worked again. Maybe all it needed was a restart. – Jesper Kristiansen Oct 26 '22 at 13:41
3

I had the same issue for all my Carthage Frameworks, the solution is:

Under Target-> [AppName] -> General -> "Frameworks, Libraries and Embedded Content"

Select "Do Not Embed" for the option next to the problematic framework.

More info are in this thread

NOTE: this might not fully solved the issue, never forget to try clean the project, restart Xcode even restart Mac sometimes.

William Hu
  • 15,423
  • 11
  • 100
  • 121
1

I solved the problem as follows: After adding 2 ".png" files, Xcode (Version 13.2.1 (13C100)) would not compile anymore. I integrated these 2 files in a .rtf file (generated from Xcode) and I succeeded in compiling again. That's how it goes.

Olivier D.
  • 31
  • 5
  • I had the same issue today with Xcode 13.4 after adding 3 PNG files. Removing extended attributes with `xattr -cr ` fixed it (for more information, see https://developer.apple.com/forums/thread/76289). – jaume May 23 '22 at 17:06
0

I fixed the problem by making sure the Code Signing Identity in Build Settings was correct - not just general Apple Development and then cleaned the Build Folder in in the Product Menu. When I ran it again it built without error.

0

I resolved a similar error in Xcode 13 by only changing my Base SDK to the latest SDK (i.e. iOS 15).

C. Bess
  • 567
  • 7
  • 10
0

I had the same issue with Xcode 14.3.1 after adding two .PNG files

running
xattr -cr on the files fixed the issue

rdf_rdfsg
  • 1
  • 2