No Detritus Allowed

Discussion in 'Mac Programming' started by Senor Cuete, Feb 18, 2017.

Tags:
  1. Senor Cuete macrumors regular

    Joined:
    Nov 9, 2011
    #1
    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
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    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.
     
  3. Senor Cuete thread starter macrumors regular

    Joined:
    Nov 9, 2011
  4. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #4
    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
     

Share This Page