24

I've installed ImageMagick with ImageMagick installer script https://github.com/maddox/magick-installer. I am on OSX Lion 10.7, using RVM, Ruby 1.9.3p125.

The problem seems to be with MagickWand.h here is the complete log

/Users/pdjimeno/.rvm/rubies/ruby-1.9.3-p125/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... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
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
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
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
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
No package 'MagickCore' found
checking for stdint.h... yes
checking for sys/types.h... yes
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
    --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/pdjimeno/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
PabloJimeno
  • 448
  • 1
  • 3
  • 7

12 Answers12

46

fix this setting the include path of your current imagemagick installation:

Install ImageMagick with brew

brew install imagemagick

find library

$ mdfind MagickWand.h
/usr/local/Cellar/imagemagick/6.7.5-7/include/ImageMagick/wand/MagickWand.h

Install rmagick gem

$ C_INCLUDE_PATH=/path gem install rmagick

example:

$ C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.5-7/include/ImageMagick/ gem install rmagick
Callum Jones
  • 595
  • 4
  • 15
xonico
  • 939
  • 1
  • 7
  • 6
  • Same here. Used the last example ending at ImageMagick/ directory. – agmcleod Jun 27 '12 at 20:30
  • 1
    The line `C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.5-7/include/ImageMagick/ gem install rmagick` allowed me to install rmagick succesfully. This is the most accurate answer. – Francisco Quintero Dec 10 '13 at 13:12
  • 2
    It may work either way in any case, but running `find /usr/local/Cellar -name MagickCore.pc` and setting the `PKG_CONFIG_PATH` environment variable solved it for me. – acobster Sep 16 '14 at 05:29
27

If you're getting Package xxx was not found.

Find the package and add it's dir path to the PKG_CONFIG_PATH variable in your ~/.bash_login or ~/.bash_profile file.

Example:

If you get the error:

Package MagickCore was not found in the pkg-config search path.

Find where the file is:

$ mdfind magickcore.pc
/usr/local/homebrew/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/MagickCore.pc

Add to your bash_login or bash_profile:

export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:/usr/local/homebrew/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/:$PKG_CONFIG_PATH"

remember to source the bash_login/profile file

Gerry Eng
  • 708
  • 1
  • 7
  • 9
  • 7
    The only thing that worked for me, tried all of the above. But only `PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/ gem install rmagick` did the trick. – prikha Dec 13 '12 at 07:00
  • 3
    Using `sudo C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/ PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/ gem install rmagick` I was able to get the rmagick install to complete. However, there were other issues and unlinking and reinstalling imagemagick was ultimately necessary. Ruby *is* more mature than Node.js et al yet switching between different versions of Ruby and Gems is still not straightforward. – james_womack Mar 27 '13 at 22:42
  • This one worked for me. I'm on Mountain Lion with homebrew + rbenv. – yagooar Apr 29 '13 at 09:42
  • C_INCLUDE_PATH didn't work, but this helped, thanks! – Ivan Linko Jul 17 '14 at 18:22
24

I suggest that you use brew to manage your binary dependencies. You can easily install imageMagick with brew, like this:

brew install imagemagick

This is what I have on my system:

imagemagick 6.7.1-1
http://www.imagemagick.org
Depends on: jpeg, libtiff, little-cms, jasper
/usr/local/Cellar/imagemagick/6.7.1-1 (1389 files, 32M)
http://github.com/mxcl/homebrew/commits/master/Library/Formula/imagemagick.rb

And I have the same setup as you have in terms of machine and ruby-version.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Ekampp
  • 755
  • 1
  • 6
  • 9
  • Imagemagick is already installed, I think that's not the problem. – PabloJimeno Apr 08 '12 at 15:46
  • 1
    It seems to me that the problem is exactly with the installation. That some headers are not where they are expected to be, or they are missing all together. I guess simply uninstalling imagemagick and installing it with brew is easier than debugging this quite complex stack trace. But suite your self =) – Ekampp Apr 08 '12 at 16:05
20

At the time of writing this, imagemagick 7 is the default version installed via brew install imagemagick, but is incompatible with rmagick. Fix this by:

  1. Remove currently installed version of imagemagick with homebrew

brew uninstall imagemagick

  1. Install imagemagick 6:

brew install imagemagick@6

  1. Run gem install with pkgconfig variable (may have to sudo depending on your config)

PKG_CONFIG_PATH=/usr/local/opt/imagemagick@6/lib/pkgconfig gem install rmagick

Keegan Brown
  • 515
  • 3
  • 5
16

Also found a solution using homebrew:

brew remove --force pkg-config
brew install pkg-config

and then

gem install rmagick
CodeGroover
  • 2,157
  • 19
  • 25
8

1) install by installer

http://cactuslab.com/imagemagick/

2) try gem install rmagick

if checking for wand/MagickWand.h... no
type

mdfind MagickWand.h

find some thing like

/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/wand/MagickWand.h

and type in terminal

C_INCLUDE_PATH=/Users/user/ImageMagick-6.8.3/include/ImageMagick-6/ gem install rmagick

if, after that you have this error (because a had it) "Package MagickCore was not found in the pkg-config search path."

type

mdfind MagickCore.pc

find some thing like /opt/ImageMagick/lib/pkgconfig/MagickCore.pc

and finally in terminal type:

PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install rmagick
Andrey Yasinishyn
  • 1,851
  • 2
  • 23
  • 36
5

Andrey Yasinishyn's solution worked for me:

mdfind MagickCore.pc

find some thing like /opt/ImageMagick/lib/pkgconfig/MagickCore.pc

and finally in terminal type:

PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig/ gem install rmagick
Ahmad Hussain
  • 2,443
  • 20
  • 27
3

When I came up against this issue, it was complaining it couldn't find MagickCore.pc, so I did this;

$ mdfind MagickCore.h
/usr/local/Cellar/imagemagick/6.8.0-10/include/ImageMagick/magick/MagickCore.h
/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/magick/MagickCore.h

$ export PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.0-10/lib/pkgconfig/
$ gem install rmagick

and it worked!

Dan Higham
  • 3,974
  • 16
  • 15
3

I tried everything, but what ended up being the solution was:

brew uninstall --force imagemagick # removes all versions

then

brew install imagemagick@6

finally

gem install rmagick

Pragmatiq
  • 77
  • 4
2

For what it is worth I had this problem with Ruby ree-1.8.7-2012-02. Here's how I fixed it:

I removed ImageMagick and re-installed it

brew remove imagemagick 
brew install imagemagick --disable-openmp --build-from-source

I then added these symbolic links in /usr/local/Cellar/imagemagick/6.8.9-7/lib/

ln -s libMagick++-6.Q16.5.dylib libMagick++.dylib
ln -s libMagickCore-6.Q16.2.dylib libMagickCore.dylib
ln -s libMagickWand-6.Q16.2.dylib libMagickWand.dylib

I then removed the Ruby version and re-installed it

rvm remove ree-1.8.7-2012-02
rvm install ree-1.8.7-2012-02

Finally installed the Gem

gem install rmagick -v '2.12.2'

Hope this helps.

Hunter
  • 1,667
  • 17
  • 24
2

For El Capitan Users,

Both PKG_CONFIG_FILE and C_INCLUDE_PATH needs to be included. The command that worked for me is:

sudo C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.9.2-4/include/ImageMagick/ PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.9.2-4/lib/pkgconfig/ gem install rmagick

Rahul Shah
  • 165
  • 2
  • 11
  • 1
    "6.9.2-4" folder changes depending on installed imagemagic version. Otherwise works like a charm. – drKreso Aug 25 '16 at 09:29
1

I had to add both the env variables to make it work. Something like this

C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/ PKG_CONFIG_PATH=/opt/local/lib/pkgconfig:/usr/local/Cellar/imagemagick/6.7.7-6/lib/pkgconfig/ gem install rmagick 
BTR Naidu
  • 1,063
  • 3
  • 18
  • 45