Last active

Get Mountain Lion and Homebrew to Be Happy

  • Download Gist

Get Mountain Lion and Homebrew to Be Happy

1) Install XCode 4.4 into /Applications

Get it from the App Store.

2) Install Command Line Tools

In XCode's Preferences > Downloads you can install command line tools.

[insert screenshot]

3) Let Everyone Know Where XCode Is

sudo xcode-select -switch /Applications/

4) Install X11

Visit and download and install 2.7.2+.

You will need to fix the symlink it makes:

ln -s /opt/X11 /usr/X11

5) Reinstall your brews

brew list

Will tell you what you need to check. Try out everything one by one and when one doesn't work brew remove it and then reinstall it. If the install doesn't work, try brew install it --use-gcc to prevent llvm from getting in the way.

Things that gave me issues that I had to remove and install:

  • macvim
  • imagemagick
  • ghostscript

You might need to install libxml2 and link it manually to make sure you don't get the wrong xml2-config if your path:

brew install libxml2  
brew link libxml2

Run brew doctor and fix anything it tells you.

You may also need to symlink gcc for certain ruby gems and other stuff like that:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

Maybe even g++ if you use that:

sudo ln -s /usr/bin/g++ /usr/bin/g++-4.2

You are good to go.

Random links that may help

Hey, thanks for the write-up! So far, I didn't have to install gcc manually (although I have llvm flavored gcc now, so this might have random compatibility problems). Also, I copied over the one in /Developer. brew worked fine after installing Command Line Tools in XCode 4.4 and doing brew update.

I wouldn't trust the llvm gcc very much, but if it works it works!

Regarding step 5, above, and the need to install gcc - on a clean 10.8, with a bare Xcode 4.4 install, and it was not a necessary step. Brewing now.

step 5 was also not needed for my installation (upgrade from lion)

Thanks man!

A quick question, since we had installed command line tools why is necessary add to our paths xcode bin ?

Fixed thx!

On 21/giu/2012, at 02:09, Andy Peters wrote:

For step 4 I had to use 'sudo'.

Reply to this email directly or view it on GitHub:

" does not have access to Command Line Tools" is what i get when i try installing the command line tools from xcode 4.4 after the mountain lion upgrade. that really sucks. does that mean homebrew, from now on, is only gonna work with a paid mac developer account?

downloaded it from but homebrew still doesn't recognize gcc:

HEAD: aefdf7ff8c2e172cf00edc7625c633ccd47e3099
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit sandybridge
OS X: 10.8-x86_64
Xcode: 4.4
GCC-4.0: N/A
GCC-4.2: N/A
LLVM: build 2336
Clang: 4.0 build 421
MacPorts or Fink? false
X11: 2.7.2 @ /opt/X11
System Ruby: 1.8.7-358
Which Perl:   /usr/bin/perl
Which Python: /usr/bin/python
Which Ruby:   /Users/philip/.rvm/rubies/ruby-1.9.3-p194/bin/ruby

so for example "gem install rmagick" fails because it can't find a C-Compiler in ${ENV['PATH']}

I have the same issue as pshizzle above. I have a paid IOS account, but not a paid Mac account, and the Xcode 4.4 version I downloaded via the app store doesn't allow me to download the command line tools. Strange! Is there a way to get them outside of Xcode, or somehow register my account properly?

You can download them directly:

Look for the last link under Xcode 4.4 section: Xcode 4.4 Command Line Tools for OS X 10.8

This is no longer necessary. Apple has since corrected their account bug. You may now get the latest command line tools from inside the Downloads tab of Xcode once again.

@uipoet: I don't see an Xcode 4.4 section there. There's a “Command Line Tools for Xcode - June 2012”, but that won't install on Mountain Lion (only Lion).

I found the right download. Worked. Now "brew doctor" reports a clean bill of health.

I was able to download command line tools from here: as others mentioned. The direct link is not accessible outside a valid session.

@chrismo I tried using that link and got an Access Denied error.

@chrismo: “Access denied”, I'm afraid.

Right before upgrading to Mountain Lion, I actually upgraded to XCode 4.4 in Lion and installed the command line tools just fine. After the upgrade to Mountain Lion, it seems they're gone and I'm unable to install them again. :/

Hmmm -- yeah, sorry, that was session specific looks like (the dmg link) -- but I just downloaded it within the last half hour.

Can someone just put the download on for us?

I tried logging in but only an older CLI tools download appears. Same problem as @stephank

Thanks @iterion… that worked for me. I tried to curl it first and that didn't work. You definitely need to be signed in and download through a sessioned browser.

Oddly enough, @iteron's link works. Here's a mirror in case the link breaks:


@iterion's link installed fine, but brew doctor now says:

Error: Your compilers are different from the standard versions for your Xcode.
If you have Xcode 4.3 or newer, you should install the Command Line Tools for
Xcode from within Xcode's Download preferences.
Otherwise, you should reinstall Xcode.

Unsurprisingly, reinstalling Xcode didn't help.

Sorry if this is crazy but I actually completely uninstalled xcode when I ran it. It's still not on my machine, maybe try it completely without xcode?

This is such a pain in the butt.

I upgraded to Mountain Lion before upgrade Xcode. Same issue here as @pshizzle , that I do not have access to the commandline tools. Unfortunately the one on the Apple Developer Tools that is released today doesn't work either. It's for Lion.

@iterion 's link works for me. Now brewing.

Thanks everybody!

The latest link may be working but it's march release which is probably very buggy.

I've uploaded CLI tools that come with xcode 4.4 GM.

Latest 10.8 dev tools


Some in this thread are not understanding that the latest release simply
does not appear for logged in users, no matter how hard they click on the
link everyone is posting.

The march release is the one that ultimately worked for me.

As for the newer one, instead of posting the link, upload to or some
hosting site.

Le jeudi 26 juillet 2012, Paul Miller a écrit :

The latest link may be working but it's march release which is probably
very buggy.

I've uploaded CLI tools that come with xcode 4.4 GM

Reply to this email directly or view it on GitHub:

Adam Kochanowicz

D'oh! Just saw your link, paul. :P

Le jeudi 26 juillet 2012, Paul Miller a écrit :

The latest link may be working but it's march release which is probably
very buggy.

I've uploaded CLI tools that come with xcode 4.4 GM

Reply to this email directly or view it on GitHub:

Adam Kochanowicz

I actually can't see the March one but I can see the latest idea why.

What is going on!!?

Le jeudi 26 juillet 2012, adamjon858 a écrit :

I actually can't see the March one but I can see the latest idea

Reply to this email directly or view it on GitHub:

Adam Kochanowicz

I doubt that the March release is very buggy. It's just a collection of standard compilation tools, which are fairly stable pieces of software.

I just tried installing the normal way through XCode again, and it is now working.

For the love of God!

Anybody having any luck with paulmillr's upload? I'll be installing on a Lion > M Lion upgrade. I was just rolling the old CLTs before the upgrade, would rather not install XCode ...

Xcode is fixed for me too now.

I've been trying to help a friend with this. It seems to be some kind of account issue on Apple's side.
I can confirm what @uipoet said, the command line tools download is now located under the XCode 4.4 listing on .
I can login in to the developer downloads and see it there, and XCode also properly downloads it from the Preferences Pane. For my friend, he can't see it in the apple developer download list, nor can he download it in XCode. Odd indeed.

UPDATE - He just tried again and it works.

Thanks, Nick. That message wasn't coming across earlier in the thread.

Several people have proclaimed the download is available in the list, but it simply isn't for some people or some of the time as you have revealed. It's not that they're not looking hard enough. That's why I recommended someone just put it on, which they did.

It makes the most sense to me for peeps to just use the links as those are pretty consistent and doesn't differ by login.

Problem solved.

Yup, I wasn't seeing the XCode 4.4 CLTs on the Apple downloads site at all. I was seeing a pretty recent version for XCode 4.3 (late July), but I understand these don't work with Mountain Lion.

I'm on a newly upgraded XCode-less system (Lion to Mountain Lion) and I installed the version here ( It seemed to work well, and homebrew started working again. I needed to do an extra step to make all formulas update/install properly (notably node):

sudo xcode-select -switch /usr/bin

See this gist:

These steps have basically straightened out my environment, all without installing XCode.

Mountain Lion version of Command Line Tools can be downloaded separately. Look inside the Xcode 4.4 tab.

No no, some of us aren't even seeing the XCode 4.4 tab at all, so no option to download those command line tools, even as a sub option. Not sure why this is. I'm in the UK and on a non-paying dev account, so maybe that's partly the reason?

@alexagui Did you not read or do you just not believe us?

The command line tools on currently don't work on 10.8. You can however use Xcode->Preferences->Downloads and hit install next to "commandline tools" there. That works on 10.8 (tested with xcode 4.4).

Also tested on XC 4.5b3 with internal CLTs.

@myobie for me sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2 was needed too (to install json gem, for example).

After installing Xcode 4.4, if there is nothing from the Xcode-Preference-Downloads pane, just restart Xcode itself. Then the command line tool appears in the list.

So far, this has been a BIG help. Thanks!

@tomekw that solved my problem, thanks.

I've updated the gist with what worked for me and added some of the other links that people have posted.

sudo xcodebuild -license

this step might be necessary sometimes too.

Seems that the august update for the command line tools just landed:

Symbolic link in brew link does not work.

Nolis-MacBook-Pro:GEOS nsicad$ brew install spatialindex
dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid
==> Downloading
Already downloaded: /Library/Caches/Homebrew/spatialindex-1.7.1.tar.gz
==> ./configure --prefix=/usr/local/Cellar/spatialindex/1.7.1 --disable-debug
==> make
==> make install
Error: The linking step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link spatialindex'
==> Summary
/usr/local/Cellar/spatialindex/1.7.1: 40 files, 2.8M, built in 28 seconds
Nolis-MacBook-Pro:GEOS nsicad$ brew list
boost geos libtool pkg-config sip spatialindex
Nolis-MacBook-Pro:GEOS nsicad$ brew link spatialindex
Linking /usr/local/Cellar/spatialindex/1.7.1...
Error: Could not symlink file: /usr/local/Cellar/spatialindex/1.7.1/lib/pkgconfig/libspatialindex.pc
/usr/local/lib/pkgconfig is not writable. You should change its permissions.
Nolis-MacBook-Pro:GEOS nsicad$

This is quite helpful! Thanks for it.

You may need to symlink g++ too.

sudo ln -s /usr/bin/g++ /usr/bin/g++-4.2

sudo ln -s /usr/bin/gcc /usr/bin/g++-4.2

i just added your gist an screenshot, would you like to fork it ?

Added a not about g++, thanks @RudthMael and @andrewsheelan.

@ekinertac your screenshot is not showing up for me.

The best part of your advices was: Reinstall your brews

Today, I ran into all sorts of problems with brew and reinstall my packages and reinstall made the trick.

Even a problema I was having with imagemagick and paperclip.

Thank you! I mean it, thank you!

It was suggested by various blogs to install homebrew's version of gcc-4.2:

brew tap homebrew/dupes && brew install apple-gcc42

RVM will use the brew installed version over the LLVM version.

If you'd like a screenshot, here you go:

Thanks for this!

When I get to step 5 I get the error, "-bash: brew: command not found"
Any ideas?

Here you can find a very useful script to download CLT:

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.