Skip to content

Instantly share code, notes, and snippets.

@vparihar01
Created August 23, 2013 09:11
Show Gist options
  • Save vparihar01/6317167 to your computer and use it in GitHub Desktop.
Save vparihar01/6317167 to your computer and use it in GitHub Desktop.
Solution for error installing Rmagick on Mountain Lion and after installation error in rmagick gem.

Error ->

dlopen(/Users/vivek/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libjpeg.8.dylib Referenced from: /usr/local/opt/imagemagick/lib/libMagickCore.5.dylib Reason: Incompatible library version: libMagickCore.5.dylib requires version 13.0.0 or later, but libjpeg.8.dylib provides version 12.0.0 - /Users/vivek/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/lib/RMagick2.bundle

Step1 : Update XCode. Get the latest one Xcode 4.6 Mountain Lion does not come with ruby headers installed before hand, so you need to do this manually from XCode. Go to Xcode Preferences/Downloads.

Install Command Line Tools

Step2: Install XQuartz

Logout and Login again. (You might not need this as imagemagick formula has been updated

Step 3: Now your ruby env would start speaking about Imagemagick errors Do this:

brew update brew remove imagemagick brew install imagemagick gem uninstall rmagick 2.13.2 gem install rmagick or gem pristine rmagick

After trying the last one, now it will give you native extension errors like this

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

    /Users/vivek/.rvm/rubies/ruby-1.9.3-p327/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 gcc-4.2... yes checking for Magick-config... yes

Warning: Found more than one ImageMagick installation. This could cause problems at runtime. /usr/local/bin/Magick-config reports version 6.8.6 Q16 is installed in /usr/local/Cellar/imagemagick/6.8.6-3 /opt/ImageMagick/bin/Magick-config reports version 6.7.8 Q16 is installed in /opt/ImageMagick Using 6.8.6 Q16 from /usr/local/Cellar/imagemagick/6.8.6-3.

checking for ImageMagick version >= 6.4.9... yes checking for HDRI disabled version of ImageMagick... yes checking for stdint.h... yes checking for sys/types.h... yes checking for wand/MagickWand.h... yes checking for InitializeMagick() in -lMagickCore... no checking for InitializeMagick() in -lMagick... no checking for InitializeMagick() in -lMagick++... no Can't install RMagick 2.13.1. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information.

*** 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 --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/vivek/.rvm/rubies/ruby-1.9.3-p327/bin/ruby --with-MagickCorelib --without-MagickCorelib --with-Magicklib --without-Magicklib --with-Magick++lib --without-Magick++lib

Gem files will remain installed in /Users/vivek/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1 for inspection. Results logged to /Users/vivek/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

Step 4: sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

cd /usr/local/Cellar/imagemagick/6.8.6-3/lib ln -s libMagick++-Q16.7.dylib libMagick++.dylib ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib

export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:/usr/local/Cellar/imagemagick/6.8.6-3/lib/pkgconfig/:$PKG_CONFIG_PATH" export MAGICK_HOME=/usr/local/Cellar/imagemagick/6.8.6-3/ This should fix all issues that Mountain Lion gifted you after the upgrade.

Just run bundle.

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