66

I have seen other people with the same issue of installing RMagick on Mountain Lion However none of the suggested solutions have allowed me to successfully install rmagick.

Here is the error message I am getting:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
checking for Ruby version >= 1.8.5... yes
checking for /usr/local/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... 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.

Things I have done:

Installed XCode
Installed the command line tools
Installed XQuartz
Installed homebrew with imagemagick library
Installed most recent version of RVM
Symlinked GCC
Uninstalled and reinstalled both RVM and imagemagick

Any ideas why I still can't download rmagick?

Community
  • 1
  • 1
tomciopp
  • 2,602
  • 2
  • 31
  • 60

8 Answers8

215

It appears it's a problem reported on the Homebrew github repo (https://github.com/mxcl/homebrew/issues/16625) blaming rmagick itself not supporting newer versions of imagemagick. On that same issue (https://github.com/mxcl/homebrew/issues/16625#issuecomment-11519383), you can find this link: https://coderwall.com/p/wnomjg which actually worked for me. This is what he does:

cd /usr/local/Cellar/imagemagick/6.8.0-10/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
starball
  • 20,030
  • 7
  • 43
  • 238
Lonecat
  • 2,697
  • 2
  • 17
  • 15
  • 13
    With the release of rmagick 2.13.2, this workaround should no longer be required. See answer below for details. – Jared Beck Feb 04 '13 at 20:31
  • I don't have this file: libMagick++-Q16.7.dylib – sites Mar 13 '13 at 19:51
  • 4
    Anyway worked with other two files, and a big command: http://stackoverflow.com/a/10645011/1197775, actually more than that command `PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/include/ImageMagick gem install rmagick -v '2.13.1'` – sites Mar 13 '13 at 19:52
  • This also works for MacPorts with ImageMagick 6.8.5-5, the library files are located in /opt/local/lib and have slightly different names. – Thomas Bindzus Jun 05 '13 at 08:55
  • It is works without `ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib` for me. – Евгений Масленков Jan 13 '15 at 18:55
31

The latest version of rmagick (2.13.2) now supports imagemagick 6.8

Jared Beck
  • 16,796
  • 9
  • 72
  • 97
8

What we did was the following:

cd /usr/local
git checkout 834ce4a Library/Formula/imagemagick.rb
brew install imagemagick

This will install Imagemagick 6.7.7-6

Besi
  • 22,579
  • 24
  • 131
  • 223
Jeff Holland
  • 276
  • 2
  • 4
5

I know this is old, but I have been through a bunch of these responses and still wasn't able to get it to work. I found a random link in another language which actually solved the problem for me (http://sugiarto.webmuapp.com/Package_MagickCore_was_not_found_in_the_pkg_config_search_path). It looks like it was looking for PKG_CONFIG_PATH which was not set up.

What worked for me:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Then make sure it worked:

find /usr -name 'MagickCore.pc'
/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig/MagickCore.pc
/usr/local/lib/pkgconfig/MagickCore.pc

Then try installing rmagick again:

gem install rmagick
Building native extensions.  This could take a while...
Successfully installed rmagick-2.13.2
1 gem installed
Installing ri documentation for rmagick-2.13.2...
Installing RDoc documentation for rmagick-2.13.2...

Success! Hope this helps anyone else still running into this issue.

benny_bates
  • 65
  • 1
  • 6
  • The link in this post is dead, but for anyone else getting the same error I did, this works (thanks!). `"No package 'MagickCore' found Package MagickCore was not found in the pkg-config search path. Perhaps you should add the directory containing MagickCore.pc' to the PKG_CONFIG_PATH environment variable"` – Matthew Du Pont Sep 03 '15 at 04:42
2

From other answers:

PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/include/ImageMagick gem install rmagick -v '2.13.1'

See https://stackoverflow.com/a/10645011/1197775 to know how to get these dirs.

Community
  • 1
  • 1
sites
  • 21,417
  • 17
  • 87
  • 146
2

Here is what worked for me on macOS Sierra.

brew uninstall pkg-config
brew install pkg-config
brew unlink pkg-config
brew link pkg-config
Evgenii
  • 36,389
  • 27
  • 134
  • 170
1

I know this is a pretty old issue but it did happen to me recently. I am posting this for those that have tried all other answers and weren't able to resolve so far. Bumping the rmagick gem to version 2.13.4 has worked with Ruby 1.9.3 on MacOS.

Hope it helps!

fagiani
  • 2,293
  • 2
  • 24
  • 31
0

check my answer to openssl problem https://stackoverflow.com/a/13958931/497756 - just make sure that imagemagick was compiled including *.pc files - which is the default for most software but not all of it.

Community
  • 1
  • 1
mpapis
  • 52,729
  • 14
  • 121
  • 158
  • I don't know how that answers the problem with installing rmagick. I'm having that problem too on a freshly formatted laptop but I can't find any kind solution on your post. – Lonecat Dec 19 '12 at 19:48
  • yu would have to find file `*magic*.pc` and provide path to it's fdirectory when installing gem: `PKG_CONFIG_PATH=/path/to/imagemagic/lib/pkgconfig gem install rmagick` – mpapis Dec 19 '12 at 20:18