Mac No Detritus Allowed

Senor Cuete

macrumors 6502
Original poster
Nov 9, 2011
303
12
After you "upgrade" to OS X 10.12.n Sierra and XCode 8.1 your projects are likely not to build. You will get an error:

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

This is because graphics apps, (like Photoshop in old versions) write additional info (we now call it metadata..) in an old fashion in external files or they came from older OSX, files like com.apple.ResourceFork" and "com.apple.FinderInfo. XCode 8.1 refuses to add files like these to a build.

A developer has written a small free app called CleanDetritus to automate the removal of these. It's available from the App Store:

https://itunes.apple.com/us/app/cleandetritus/id1161108431?ls=1&mt=12
 

chown33

Moderator
Staff member
Aug 9, 2009
8,826
5,246
vertical
I'm pretty sure you can do the same thing with the 'xattr' command.

The -c option clears all xattrs, which includes a resource fork (try it). Also, the -r option applies the action recursively, so an entire directory of files and sub-dirs can be cleared at once.

If one wishes to only strip resource-forks and FinderInfo, a more targeted invocation of 'xattr' would be required. Again, the -r option is likely to be useful.

One nice thing about using the 'xattr' command is you can put it into your Xcode build process, so it cleans files automatically.

I haven't tried xattr removal in an Xcode project, but I have used 'xattr' to apply certain xattr's to files in an Xcode project, and it worked fine.
 

chown33

Moderator
Staff member
Aug 9, 2009
8,826
5,246
vertical
Great, so how about a command to do this?
Example:
Code:
xattr -c -r "$SRCROOT"
WARNING: Don't try this unless you're sure the SRCROOT build setting in your Xcode project only encompasses your source files, AND those source files contain no xattr's or resource-forks you need to keep.

If you only want to delete specific xattr's, like ResourceFork and FinderInfo, use the -d option and specify the xattr name (see 'man xattr'). If you only want to target a specific sub-dir of SRCROOT, construct its pathname accordingly.

Another build setting that may refer to a dir of interest: PROJECT_DIR

Reference to build-setting names:
https://pewpewthespells.com/blog/buildsettings.html
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.