Xcode Run Script Phase: A Tip & A Plug

As part of the Mugshot build process, I have a custom AppleScript that runs and converts my Flickr method bindings OmniOutliner document into a different format so it can get bundled and included with the app. (It’s much less complicated than it sounds, I swear.) I have this script included in my build phase as a “Run Script” phase.

Since I only update this document when I add new features to Mugshot that require new methods from Flickr’s web services, I don’t need to run this export every time. To handle this, the script stores its own “last run date” and compares that against the modification date on the OmniOutliner document. If document is older, then the script just exits. However, because the script is storing a value inside itself, the script file actually shows up in my Subversion listings after every build. Mildly Frustrating.

But I was just reading Step Into Xcode by Fritz Anderson (Amazon link) and he mentioned that Xcode can manage the modification date issue for me! In the Run Script build phase setup, add your input and output documents to the respective lists. Here’s how I set mine up this morning:


Now, Xcode will only run that build phase if the input documents are newer than the output documents, which means I can both remove all the modification code from my script AND not have to worry about my script showing up as modified in Subversion! That’s a double-win.

And that’s reason for the plug: If you use Xcode, I highly recommend this book. Whether you’re a beginning or advanced Xcode user, I think you’ll find tips worth using!

0 Responses to “Xcode Run Script Phase: A Tip & A Plug”


  1. No Comments

Leave a Reply