Skip to content

Instantly share code, notes, and snippets.

Created February 18, 2012 20:14
Show Gist options
  • Save myobie/1860902 to your computer and use it in GitHub Desktop.
Save myobie/1860902 to your computer and use it in GitHub Desktop.
Get Mountain Lion and Homebrew to Be Happy

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

Copy link

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.

Copy link

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.

Copy link

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: Homebrew/legacy-homebrew#13337 (comment)

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

Copy link

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

Copy link

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?

Copy link

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

Copy link

nico commented Jul 26, 2012

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

Copy link

Also tested on XC 4.5b3 with internal CLTs.

Copy link

tomekw commented Jul 27, 2012

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

Copy link

boklee commented Jul 27, 2012

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.

Copy link

esilvas commented Jul 28, 2012

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

Copy link

@tomekw that solved my problem, thanks.

Copy link

myobie commented Jul 30, 2012

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

Copy link

Panajev commented Aug 3, 2012

sudo xcodebuild -license

this step might be necessary sometimes too.

Copy link

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

Copy link

ns-1m commented Aug 10, 2012

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$

Copy link

This is quite helpful! Thanks for it.

Copy link

rgalite commented Sep 13, 2012

You may need to symlink g++ too.

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

Copy link

Thanks man

Copy link

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

Copy link

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

Copy link

myobie commented Dec 11, 2012

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

@ekinertac your screenshot is not showing up for me.

Copy link

Rogerio commented Dec 13, 2012

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!

Copy link

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.

Copy link

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

Thanks for this!

Copy link

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

Copy link

mcella commented Apr 16, 2013

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

Copy link

is this a joke or what ?

Copy link

shape55 commented Sep 16, 2018

I went thru all the above steps for 10.8.5 but when I went to install Homebrew it gives me this error:

Downloading and installing Homebrew...
fatal: unable to access '': error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version
Failed during: git fetch origin master:refs/remotes/origin/master --tags --force

I tried researching this error but couldn't find anything relevant to my specific issue. I also made sure I had curl installed as that was mentioned in some of the feedback I reviewed, and I have this:

curl 7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8} zlib/1.2.5

The only issue I ran into along the way was with X11, where I got a "Permission Denied" error after entering "ln -s /opt/X11 /usr/X11". However, I installed the latest version of it, which is 2.7.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment