Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gem install rmagick -v 2.13.1 error Failed to build gem native extension on Mac OS 10.9.1

I have tried everything by giving path of MagickWand.h, I have command tools installed. Can anyone help me out ?

$ gem install rmagick -v 2.13.1

Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension.

/Users/ghazanfarali/.rvm/rubies/ruby-1.8.7-p357/bin/ruby extconf.rb checking for Ruby version >= 1.8.5... yes checking for /usr/bin/gcc-4.2... yes checking for Magick-config... yes checking for ImageMagick version >= 6.4.9... yes checking for HDRI disabled version of ImageMagick... yes checking for stdint.h... no checking for sys/types.h... no checking for wand/MagickWand.h... no

Can't install RMagick 2.13.1. Can't find MagickWand.h. * 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/ghazanfarali/.rvm/rubies/ruby-1.8.7-p357/bin/ruby

Gem files will remain installed in /Users/ghazanfarali/.rvm/gems/ruby-1.8.7-p357/gems/rmagick-2.13.1 for inspection. Results logged to /Users/ghazanfarali/.rvm/gems/ruby-1.8.7-p357/gems/rmagick-2.13.1/ext/RMagick/gem_make.out "

like image 980
user3148077 Avatar asked Jan 09 '14 14:01

user3148077


2 Answers

I strongly suggest using something like HomeBrew, if you are not already, to manage OSX packages. There are alternatives, including MacPorts.

RMagic is simply a ruby interface with ruby bindings for the underlying ImageMagic package.

I would make sure the latest imagemagick is installed:

brew install imagemagick

Or, if already installed:

brew upgrade imagemagick

Or, per this answer:

# install latest command line tools via xcode     
# make sure you have the latest homebrew with the latest packages 
brew update
# uninstall imagemagick and then reinstall to make use updated compiler
brew uninstall imagemagick
brew install imagemagick
# uninstall rmagick then reinstall to ensure native extensions are built against
# latest imagemagick
gem uninstall rmagick
gem install rmagick # or bundle

Additionally, you can run:

brew doctor

to identify any issues that may affect the building of these packages.

Update


Two approaches:

  1. RMagick was recently updated to fix build issues related to the latest ImageMagick. Use version 2.13.2. Per the RMagick README: This release will fix the installation issues due to ruby 1.9.3 and ImageMagick 6.8+.

  2. Probably the better approach. Replace rmagick with mini_magick as mini_magick is being actively developed and rmagick is not. Imagemagick is also in active development, so as it's API changes, RMagick's dated API will become more and more stale.

like image 66
Matt Dressel Avatar answered Oct 29 '22 08:10

Matt Dressel


Please check answers for this question. Maybe you just need:

brew install imagemagick
like image 26
Anton Tsapov Avatar answered Oct 29 '22 08:10

Anton Tsapov