"rmagick" gem installation issue

try installing

  sudo apt-get install libmagickwand-dev imagemagick

This ImageMagick 7 with RMagick 2.16 on MacOS Sierra Can't find MagickWand.h works for Rmagick 2.16.

brew install imagemagick@6
brew link --force imagemagick@6
gem install rmagick

The error message says:

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

It seems you missing no package at all, you just have to tell pkg-config where to find the MagickCore.pc file to build the extension. If you have installed the package ImageMagick-devel using yum the file should be inside the directory /usr/lib/pkgconfig or /usr/lib64/pkgconfig (depending on your architecture). Check with this command (from now I assume you are on a amd64 machine, if it's not the case replace lib64 with lib):

$ find /usr/lib64/pkgconfig -name MagickCore.pc

If the file is there you just have to install rmagick with this command:

$ PKG_CONFIG_PATH='/usr/lib64/pkgconfig' gem install rmagick

The problem is, as the error puts it,

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

The solution is also suggested there:

add the directory containing MagickCore.pc to the PKG_CONFIG_PATH environment variable

So,

  1. Find MagickCore.pc location:

    sudo find / -name MagickCore.pc
    
  2. If it is not found, probably ImageMagick is not installed on your system — then install it (Google how to do it, as it depends on the OS)

  3. Save it to the ENV var like that (make sure to put the path found in step 1):

    PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
    
  4. Retry installing RMagick


For Mac with Brew, simply..

brew install imagemagick

Then gem install imagemagick will work smoothly.