Xcode Messes with Time Machine … too much

Watch out if you are using Xcode for non-Mac-App-Store builds.  It may exclude more than you realize from Time Machine.

In the following experiment, I configured Xcode to build Smarky two levels up from the project directory, into a directory named Builds2.  The app target’s Build Settings > Build Locations looks like this…

As you can see, this setting was propagated into the Intermediate Build FIles Paths too.

Next, I deleted the Builds2 directory (if any), so that we are starting over from scratch.  Then, I executed a Release build (using xcodebuild).  Here is what it produced…


To the naked eye, all looks as expected.

But wait.  Lets look at these directories' pesky Extended Attributes.

As expected and desired, because it contains garbage, the
Intermediate Build Files directory has Time Machine exclusions…

Air2:~ jk$ xattr -l /Users/jk/Documents/Programming/Builds2/BkmkMgrs.build
com.apple.XcodeGenerated: Yes
com.apple.metadata:com_apple_backup_excludeItem:
00000000  62 70 6C 69 73 74 30 30 5F 10 11 63 6F 6D 2E 61  |bplist00_..com.a|
00000010  70 70 6C 65 2E 62 61 63 6B 75 70 64 08 00 00 00  |pple.backupd….|
00000020  00 00 00 01 01 00 00 00 00 00 00 00 01 00 00 00  |…………….|
00000030  00 00 00 00 00 00 00 00 00 00 00 00 1C           |………….|
0000003d

But the Build Products directory has none of these.  That is as expected too …

Air2:~ jk$ xattr -l /Users/jk/Documents/Programming/Builds2/Release
Air2:~ jk$

But I get a nasty surprise when I examine xattrs of the root Builds2 directory …

Air2:~ jk$ xattr -l /Users/jk/Documents/Programming/Builds2
com.apple.XcodeGenerated: Yes
com.apple.metadata:com_apple_backup_excludeItem:
00000000  62 70 6C 69 73 74 30 30 5F 10 11 63 6F 6D 2E 61  |bplist00_..com.a|
00000010  70 70 6C 65 2E 62 61 63 6B 75 70 64 08 00 00 00  |pple.backupd….|
00000020  00 00 00 01 01 00 00 00 00 00 00 00 01 00 00 00  |…………….|
00000030  00 00 00 00 00 00 00 00 00 00 00 00 1C           |………….|
0000003d

So Xcode / xcodebuild has excluded not only the Intermediate Build Files directory from Time Machine, but the parent directory of this directory as well.

This is not too good if you have, for example, as I do, another subdirectory in that parent folder for storing other needed files such as version archives (zipped products, disk images and dSYM files).

The above was performed with Xcode 5.1.1, and I've filed Apple Bug 17922437 on the behavior.