41

I was trying to install rmagick and it always asks for PKG_CONFIG_PATH not configured.

This happened multiple times to me, so I'm posting this as an issue and answering myself for anyone else facing same issue.

User-MacBook-Pro:rsscom macuser$ gem install rmagick -v '2.13.3'
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

    /Users/macuser/.rvm/rubies/ruby-2.2.0/bin/ruby -r ./siteconf20160705-63310-klqxmw.rb extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... 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 0.0.0. 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/macuser/.rvm/rubies/ruby-2.2.0/bin/$(RUBY_BASE_NAME)

extconf failed, exit code 1

Gem files will remain installed in /Users/macuser/.rvm/gems/ruby-2.2.0/gems/rmagick-2.13.3 for inspection.
Results logged to /Users/macuser/.rvm/gems/ruby-2.2.0/extensions/x86_64-darwin-14/2.2.0-static/rmagick-2.13.3/gem_make.out
Ashwin Yaprala
  • 2,737
  • 2
  • 24
  • 56
  • 6
    `brew install imagemagick` on macOS. https://stackoverflow.com/questions/10063051/bundle-cant-install-rmagick-gem-on-mac-osx-10-7 – Jeremy Cochoy Nov 13 '20 at 08:32
  • 3
    You might need to install imagemagick v6, depending on your rmagick version: `brew install imagemagick@6 && brew link imagemagick@6 --force` – Capripot Oct 06 '21 at 01:10

4 Answers4

74

I have the the same problem. This work for me (Ubuntu):

sudo apt-get install libmagickwand-dev
Community
  • 1
  • 1
Goko Gorgiovski
  • 1,364
  • 2
  • 13
  • 20
31

rmagick gem is not able find PKG_CONFIG_PATH while installing. We need to tell where the path for the ImageMagick exists. It's always better to add in the bash.

export PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.9.3-7/lib/pkgconfig
Ashwin Yaprala
  • 2,737
  • 2
  • 24
  • 56
  • More recent homebrew installs of imagemagick@6 will have an export path as follows: `export PKG_CONFIG_PATH="/opt/homebrew/opt/imagemagick@6/lib/pkgconfig"` Run `brew info` to get the export path specific to your installation. – Dylan Fisher Aug 08 '23 at 20:34
20

This just solved the issue for me (works on ubuntu 18.04):

sudo apt-get install libmagick++-dev
Marc Tang
  • 3
  • 3
FMM
  • 1,857
  • 1
  • 15
  • 38
  • This worked for me for the related `Package Magick++ was not found in the pkg-config search path.` error – Scriddie Sep 01 '22 at 16:20
5

CentOS

yum install ImageMagick-devel
XiaoChi
  • 369
  • 4
  • 4