Command CodeSign failed with a nonzero exit code
When developing an iOS application using Xcode, one of the common steps in the build process is code signing. Code signing is essential as it verifies the authenticity and integrity of your app. However, developers often encounter issues during this step. Recently, I faced a code signing error while working on the “TruthOrDare” project, and I’d like to share the solution.
The Error Message
During the build process of the “TruthOrDare” app, the following error message was encountered:
CodeSign /Users/user/Library/Developer/Xcode/DerivedData/TruthOrDare-awaulhsocmfdqlcupxjyhbnbmlqv/Build/Products/Debug-iphonesimulator/TruthOrDare.app (in target 'TruthOrDare' from project 'TruthOrDare')
cd /Users/user/Documents/06_UPWORK/TruthOrDare\ updated\(Turkey\)
Signing Identity: "-"
/usr/bin/codesign --force --sign - --entitlements /Users/user/Library/Developer/Xcode/DerivedData/TruthOrDare-awaulhsocmfdqlcupxjyhbnbmlqv/Build/Intermediates.noindex/TruthOrDare.build/Debug-iphonesimulator/TruthOrDare.build/TruthOrDare.app.xcent --timestamp\=none --generate-entitlement-der /Users/user/Library/Developer/Xcode/DerivedData/TruthOrDare-awaulhsocmfdqlcupxjyhbnbmlqv/Build/Products/Debug-iphonesimulator/TruthOrDare.app
/Users/user/Library/Developer/Xcode/DerivedData/TruthOrDare-awaulhsocmfdqlcupxjyhbnbmlqv/Build/Products/Debug-iphonesimulator/TruthOrDare.app: resource fork, Finder information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code
Understanding the Error
The key part of the error message is:
resource fork, Finder information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code
I found the same error in StackOverflow and there how to fix it use this link
For my case here the solution, just run this in terminal, Here’s the step-by-step solution:
- Open Terminal: Navigate to your project directory in the terminal. This can be done by using the
cd
command to change to the appropriate directory where your project files are located. For instance:
$ cd /Users/user/Documents/06_UPWORK/TruthOrDare\ updated\(Turkey\)
2. Remove Extended Attributes: Use the xattr
command with the -cr
option to recursively remove all extended attributes from the current directory. The command is:
$ xattr -cr .
3. Rebuild the project again
Conclusion
By running xattr -cr .
in your project directory, you can eliminate unwanted extended attributes that interfere with the code signing process. This simple terminal command can save you time and frustration, ensuring that your development process remains smooth and uninterrupted. If you encounter similar issues, give this solution a try, and it may just resolve your problem.