Can't install rmagick, pkg-config: command not found

Minh Tri Pham picture Minh Tri Pham · May 15, 2014 · Viewed 16.4k times · Source

I'm trying to install rmagick on my Mac OS X v10.9 (Mavericks) machine. However. I get this error

/usr/local/bin/Magick-config: line 41: pkg-config: command not found
/usr/local/bin/Magick-config: line 47: pkg-config: command not found
/usr/local/bin/Magick-config: line 50: pkg-config: command not found
/usr/local/bin/Magick-config: line 53: pkg-config: command not found
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... yes
/usr/local/bin/Magick-config: line 53: pkg-config: command not found
Can't install RMagick 2.13.2. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information.

The lines 41,17,50,53 in Magick-config are

--cflags)
  pkg-config --cflags MagickCore
  ;;
--cxxflags)
  pkg-config --cflags MagickCore
  ;;
--cppflags)
  pkg-config --cflags MagickCore
  ;;
--ldflags)
  pkg-config --libs MagickCore
  ;;
--libs)
  pkg-config --libs MagickCore
  ;;

I installed ImageMagick with brew install imagemagick --build-from-source and before running gem install rmagick, I set the path to MagickCore.pc with export PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.9-1/lib/pkgconfig and the path to Wand.h with export C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.8.9-1/include/ImageMagick-6/.

This worked for the Wand, but not for MagickCore, as I still get pkg-config: command not found.

I use Ruby 1.9.3p545 and Ruby on Rails 3.2.16.

How can I fix this problem?

Answer

Paul Verschoor picture Paul Verschoor · May 30, 2014

I had the same issue with Rmagick after upgrading to Maverick. This solved it:

brew uninstall pkg-config
brew install pkg-config
brew unlink pkg-config && brew link pkg-config