CodeSign error (nonzero exit code) HELP

Help with CodeSign error:



<DerivedData PATH> resource fork, Finder information, or similar detritus not allowed

Command CodeSign failed with a nonzero exit code



Any idea? Thanks

Thanks


Found the answer online. Here it is. Hope it helps others using MacCatalyst.


Go to Targets > Built Phases > Run Script:

xattr -cr ~/Library/Developer/Xcode/DerivedData || echo Clear

I suggest searching for bundle for a resource fork, Finder information, or similar detritus.

Accepted Answer

Thanks


Found the answer online. Here it is. Hope it helps others using MacCatalyst.


Go to Targets > Built Phases > Run Script:

xattr -cr ~/Library/Developer/Xcode/DerivedData || echo Clear

Similar issue with Xcode 12 and target macOS 11.x

Universal app written in SwiftUI.

Suspect the cause of the issue was my late interruption of a build and run command. Not at all certain about this however.

Searched A LOT but no other suggestions worked, including deleting keychain items and build folders and creating new certificates and provisioning profiles.

The only solution that worked for me was to let Xcode automatically manage signing and to add the script detailed in the answer by @IndustrialDesigner

PS for clarity the script was added for the macOS target under "Build Phases" by clicking the + button and selecting "New Run Script Phase", then copying the script into the black script "box" under the Shell/bin/sh line.

Mine is an Obj-C MacOS X project with several targets, Running latest Xcode 12.5.1. Failing target is a normal Cocoa App.

It started failing with this exact error after I dragged an image file to the project (into Resources group/directory), added to the target and tried to build. I use this image resource programmatically. Failed again and again. Removing the image removed the problem.

I found the image file WAS NOT copied to the project repo, and the reference pointed to somewhere outside the repo. I deleted the reference from the project, copied the actual file into the project repository, re-added it to my project/group and target. Verified the reference was now inside the project repo (relative to group, with just the file name as a 'path').

Now it built OK.

I then dragged another image (this time I first copied it into my Resources group/directory) and sad to say - the problem resurfaced.

Reading other answers here, I saw the proposed build script: xattr -cr ~/Library/Developer/Xcode/DerivedData || echo Clear

So I started to suspect the actual image files had something about them that was not to Xcode's liking. so... a Quick Terminal shell:

mini-mac7:Resources $ ls -la@    total 392 drwxr-xr-x   5 mshneor  staff     160 Jun 28 13:57 . drwxr-xr-x  12 mshneor  staff     384 Jun 28 13:44 .. -rw-r--r--@  1 mshneor  staff   19688 Jun 28 13:44 MyPtShield.png com.apple.lastuseddate#PS     16  -rw-r--r--@  1 mshneor  staff  172435 Mar 16  2017 My-logo-reg-K.png com.apple.FinderInfo     32  com.apple.lastuseddate#PS     16  com.apple.quarantine     57  -rw-r--r--@  1 mshneor  staff     258 Jun 28 13:44 factoryDefaults.plist com.apple.lastuseddate#PS     16 

And sure enough - both image files DO HAVE extra information and extended attributes.

So this time, I ran that script once, directly at my Resources directory, thus removing all Extended attributes from the resource files, like this

mini-mac7:Resources $ xattr -cr . || echo Clear mini-mac7:Resources $ ls -la@                   total 392 drwxr-xr-x   5 mshneor  staff     160 Jun 28 13:57 . drwxr-xr-x  12 mshneor  staff     384 Jun 28 13:44 .. -rw-r--r--   1 mshneor  staff   19688 Jun 28 13:44 PfPtShield.png -rw-r--r--   1 mshneor  staff  172435 Mar 16  2017 Proofpoint-logo-reg-K.png -rw-r--r--   1 mshneor  staff     258 Jun 28 13:44 factoryDefaults.plist mini-mac7:Resources $ 

And sure enough - next build worked like a charm. I really hope git is smart enough to push the removal of extended attributes to the repo too.

CodeSign error (nonzero exit code) HELP
 
 
Q