How upgrading to Lion and performing a clean re-install of Xcode 4.3 made Homebrew cry and how to fix it.

Archive note: The original hero image for this post is unavailable in this archive.

I had the brilliant idea to upgrade to OS X Lion and perform a clean re-install of Xcode 4.3. As with most brilliant ideas that involve upgrading software this was actually a bit of a regrettable decision. But fret not, people have worked out how to resolve the issue and here's what I got to work (for me (on my machine)).

Let us begin...

So, you've upgraded to OS X Lion. That's nice. Yeah, I like the new animations too. But you already have an old installation of Xcode 4.x that works just fine left over from your Snow Leopard install? Tsk, tsk. This will not do. You need to have a fresh and clean install of Xcode if you really want to suff... er, ohh. You want things to woooork. Okay, let's see if this can do.

To completely wipe out your previous Xcode install run:

sudo /Developer/Library/uninstall-devtools –mode=all

You have completely and irrevocably uninstalled Xcode from your system. I like to be thorough and clean my caches using Onyx and CleanMyMac as well, but that's up to you.

Go ahead and download Xcode from the App Store. Apple has updated the installation process with the current release of Xcode and no longer forces you to download the "Install Xcode.app"utility, it's all one self-contained package.

Now you have Xcode installed but you'll notice that make and gcc and little tools like that are no longer present. You'll need to install the Command Line Tools.

Xcode Preferences Downloads panel

You may be thinking, "Great! I can use the command line tools from the command line now. This is wonderful." Not so quick. You had a previous install that you used the official uninstaller that completely removed every crufty piece of yesterday's technology and left you with a pristine canvas on which to install today's obviously superior technology. Not quite, there's one small detail left over.

Run:

xcode-select -print-path

If the utility printed /Developer then you'll need to do one more thing to get Homebrew happily compiling again.

Xcode no longer uses the /Developer because that was hard to maintain and keep up to date with all the new-shiny from Cupertino through App Store. Since everything Apple is being delivered via the App Store these days it makes sense that something had to give. Instead you'll your friendly make and gcc tools under /Applications/Xcode.app/Contents/Developer.

This is an easy fix fortunately.

Run:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/

Then verify the path is set by running xcode-select again:

xcode-select -print-path

Now go ahead and have fun building your Homebrew based utilities and be sure to read https://github.com/mxcl/homebrew/issues/9179 which is where I gleaned these steps from.

Again, this worked for me on my machine. I make no warranty that it won't render your machine limp and lifeless.