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.

screen-shot-2011-06-24-at-10-35-04-am

Download XCode 4.1 from the Mac App Store, then control-click on Install XCode.app and select Show Package Contents.

Screen Shot 2011-07-24 at 8.48.04 PM

Navigate to the Contents/Resources directory so that you can see both Xcode.mpkg and the Packages directory.

Screen Shot 2011-07-24 at 8.48.40 PM

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.)

Screen Shot 2011-07-24 at 8.49.16 PM Screen Shot 2011-07-24 at 8.50.12 PM

The last piece is telling the installers to run. For this, you’ll need a postflight script. Here’s the one I’m using:

—–


#!/bin/sh
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.

  1. July 25, 2011 at 2:17 am

    Thanks, Rich! As a side note – I installed Xcode, but it stalled out and I had to force quit. I’m reinstalling via the package.

    The whole “bundling a package within an app” and “bundling a DMG within an app” thing is weirding me out. Seems like an unnecessary extra layer, to me.

  2. August 1, 2011 at 8:50 pm

    Rich: this seems like overkill. Just make a disk image and copy the Xcode.mpkg and the Packages directory to it. To install Xcode 4, double-click Xcode.mpkg, or direct your favorite installation automation utility to install the Xcode.mpkg. No need to fire up Iceberg or Packages or PackageMaker…

    • August 1, 2011 at 9:01 pm

      Greg,

      YMMV depending on your needs. I’d built this XCode 4.1 package for deployment from my DeployStudio server, where it runs as part of a thin imaging workflow’s postponed installations.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 153 other followers

%d bloggers like this: