Repackaging XCode 4.1
As part of the release of 10.7, Apple has also released XCode 4.1 through the Mac App Store for free. While I applaud their generosity, having the Mac App Store be the delivery method can cause issues for those folks who need to add XCode to their machine deployment workflow.
To address this, you can use the methodology referenced in this post to repackage XCode 4.1 for distribution without needing an Apple ID. See below the jump for the procedure.
Set up a new Iceberg project. Since we’ll need to run this installer with root privileges, I recommend setting the project type to Darwin: Package. That will open the project with the installation privileges automatically set to root. In this case, I’m naming the project XCode 4.1 Installer.
Download XCode 4.1 from the Mac App Store, then control-click on Install XCode.app and select Show Package Contents.
Navigate to the Contents/Resources directory so that you can see both Xcode.mpkg and the Packages directory.
Select both Xcode.mpkg and the Packages directory and drag both into the Additional Resources section of your Iceberg project. (The order doesn’t matter.)
The last piece is telling the installers to run. For this, you’ll need a postflight script. Here’s the one I’m using:
sudo installer -dumplog -verbose -pkg "$1/Contents/Resources/Xcode.mpkg" -target /
Once you’ve got the postflight script built, run the following command to make the script executable:
sudo chmod a+x /path/to/postflight
Last step, go ahead and build the package. (If you don’t know to build, check the Help menu for the Iceberg User Guide. The information you need is in Chapter 3 – Creating a package.)
Once the package has been built, test it by taking it to a test machine running 10.7 that doesn’t have XCode 4.1 and install it. The end result should be that XCode 4.1 installs without requiring an Apple ID.