Fix: resource fork Finder information not allowed code sign error in Xcode

Fix: resource fork Finder information not allowed code sign error in Xcode

Written by

in

Quick answer: The error occurs when files in your Xcode project carry extended attributes (like Finder metadata from Photoshop). Fix it by running xattr -cr . in your project root directory, then clean and rebuild in Xcode.

Why this happens

When you add image assets or other files to an Xcode project, they may carry extended attributes — metadata written by macOS Finder or graphics editors such as Photoshop. Common examples include com.apple.FinderInfo and resource forks that store thumbnail previews, color profiles, or custom icons.

During code signing, codesign scans every file in the app bundle. If it encounters these extended attributes on any file (especially PNG, JPEG, or JSON assets), it aborts with:

resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1

This is a security measure: Apple’s codesign tool refuses to sign bundles that contain non-portable filesystem metadata, because those attributes can change across machines and break signature validation.

How to fix it

1. Remove all extended attributes recursively (quickest fix)

Open Terminal, cd to your project root directory (the folder that contains .xcodeproj or .xcworkspace), and run:

xattr -cr .
  • -c clears all extended attributes.
  • -r recurses into subdirectories.

After the command finishes, return to Xcode, choose Product → Clean Build Folder (⇧⌘K), then build again.

2. Target only image assets (safer for large repos)

If you prefer to limit the operation to the file types that typically carry Finder metadata, run each line below from the project root:

find . -type f -name '*.png'  -exec xattr -c {} \;
find . -type f -name '*.jpg'  -exec xattr -c {} \;
find . -type f -name '*.jpeg' -exec xattr -c {} \;
find . -type f -name '*.json' -exec xattr -c {} \;

Clean and rebuild as above.

3. Inspect and clear specific files (forensic approach)

To see exactly which files have extended attributes before wiping them:

ls -alR@ . > xattr_report.txt

Open xattr_report.txt and search for com.apple.FinderInfo or com.apple.ResourceFork. For each listed file, run:

xattr -c path/to/file.png

Then clean and rebuild.

How to prevent it

  • Export assets without metadata: In Photoshop, use File → Export → Export As… and uncheck “Include Metadata”. In Sketch/Figma, choose exports that strip metadata.
  • Add a pre-build script (optional): Add a Run Script build phase before “Copy Bundle Resources” that runs xattr -cr "${PROJECT_DIR}" — but be aware this runs on every build and may slow incremental builds.
  • Audit third-party asset packs: Vendors sometimes ship images with Finder tags. Run the find commands above on any new asset folder before committing.
  • Use .gitattributes to normalize: Add * -text and ensure core.autocrlf=input so Git doesn’t introduce its own metadata on checkout.

FAQ

Does xattr -cr . delete any important file data?

No. It only removes extended attributes (metadata stored outside the file’s data fork). The actual image pixels, JSON content, or source code remain untouched.

Why does the error appear only on device builds, not simulator?

Simulator builds are not code-signed with a distribution identity, so codesign never runs. Device and Archive builds invoke the full signing pipeline, which enforces the attribute check.

Can I fix this inside Xcode without Terminal?

Xcode has no built-in UI for stripping extended attributes. The Terminal commands above are the standard, Apple-supported workaround. You can add a Run Script phase to automate it, but the one-off Terminal fix is usually faster.


Sources & credits

Parts of this guide are adapted from content licensed under CC BY-SA 4.0; this article is shared under the same license.