Installing MacPorts on Lion with Xcode 4 from the App Store

Installing MacPorts on Lion requires first installing Xcode 4.1.  Apple makes Xcode available as a download to developers who have subscribed as Mac developers for $99 per year, or for free through the Mac App store.  Unfortunately, the Xcode installer that the App Store downloads does not install the “Unix Development” or “System Tools” components required by MacPorts.

After much fiddling, I found a way to install Xcode 4.1 from the Mac App Store and get the “Unix Development” and “System Tools” components.  Here is what I did:

  1. Install Xcode 4 through the App Store
  2. Go to the /Applications folder
  3. The “Install Xcode” application is the installer that the App Store used to install Xcode (without the components you want).  Right click on “Install Xcode” and select “Show Package Contents”.
  4. Open Contents/Resources and double click on Xcode.mpkg

Double clicking the mpkg installer will give the option to install Xcode in a custom location and to customize which components are installed, including “Unix Development” and “System Tools”.

The install process took my laptop about 30 minutes to complete.  It might be possible to cancel the initial install after “Install Xcode” has been fully downloaded, then proceed to the mpkg install, but I have not tested that.


Advertisements

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