Skip to content

Instantly share code, notes, and snippets.

@juandazapata
Created July 26, 2012 15:07
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save juandazapata/3182604 to your computer and use it in GitHub Desktop.
Save juandazapata/3182604 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

After upgrading to Mountain Lion, I got this message when trying to run my local rails server:

Installing rmagick (2.13.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    Users/user/.rvm/rubies/ruby-1.9.3-rc1/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for /usr/bin/gcc-4.2... no
No C compiler found in ${ENV['PATH']}. See mkmf.log for details.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/user/.rvm/rubies/ruby-1.9.3-rc1/bin/ruby

Gem files will remain installed in /Users/user/.rvm/gems/ruby-1.9.3-rc1@some_gemset/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/user/.rvm/gems/ruby-1.9.3-rc1@some_gemset/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
An error occured while installing rmagick (2.13.1), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.

Here is what I did:

1) Install XCode 4.4 into /Applications

Download or update your XCode 4.4 from the AppStore. If you have any previous XCode versions in you Developer folder, just delete them.

2) Install Command Line Tools

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

3) Let Everyone Know Where XCode Is

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

4) Install X11

Download Quartz 2.7.2+, then install it

You will need to fix the symlink it makes:

ln -s /opt/X11 /usr/X11

5) Reinstall your imagemagick

brew install imagemagick

6) Symlink gcc

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

7) Bundle

cd your_app && bundle install
@daliborfilus
Copy link

Point 6 should be changed to

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

as sudo su && whatever doesn't work.

@juandazapata
Copy link
Author

It worked for me, however your implementation is cleaner.
I just made the correction.

@andycopley
Copy link

Thank you! Made my life so much easier.

@tlluiz
Copy link

tlluiz commented Aug 22, 2012

In my case i used:

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

@jeff-savin
Copy link

Perfect, this helped tons, thanks. :)

@bertomartin
Copy link

Works great! Thank you.

@rempargo
Copy link

Had same issues, and this solved it.
But I don't understand why the Quartz 2.7.2+ is needed for.

@stardanz1
Copy link

I am not upgrading but have a new iMac with Mountain Lion pre-installed. I want to install the ImageMagick extension. Two questions, will your 7-step setup work (since I'm not Reinstalling, first time Install) and do I need Step 4 (Install X11) since I see an X11 folder under directory /etc/X11

@UnConundrum
Copy link

I have a brand new iMac and none of this worked. Finally found a manual install for imagemagick that did the trick. See https://coderwall.com/p/mwtoya?comment=Thanks.++After+fighting+for+hours%2C+this+was+the+solution

@obedeugene
Copy link

This is great. After days of searching, thissolved the problem. Thanks alot.

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