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

17,057

Solution 1

Reinstalling pkg-config solved the issue for me.

Solution 2

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

Solution 3

brew install pkg-config fixed this for me.

Share:
17,057

Related videos on Youtube

Minh Tri Pham
Author by

Minh Tri Pham

Updated on June 07, 2022

Comments

  • Minh Tri Pham
    Minh Tri Pham almost 2 years

    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?

    • emcconville
      emcconville almost 10 years
      Looks like you'll need to install pkg-config or updated PATH to include it's location. Building from source expects this utility to be on the system.
    • Minh Tri Pham
      Minh Tri Pham almost 10 years
      pkg-config already came installed with homebrew. what PATH do you want me to update?
    • Eric Baldwin
      Eric Baldwin almost 10 years
      Are you sure pkg-config is in the location you specified? Check with which pkg-config. For me, it's in /usr/local/bin/pkg-config though I am using OSX 10.7.5
  • Lyndsey Ferguson
    Lyndsey Ferguson over 9 years
    In my case, brew uninstall pkg-config failed so I just ran brew install pkg-config and that fixed my issue.
  • Raymond Gan
    Raymond Gan almost 9 years
    Yesssss!!!! After several hours of unsuccessfully trying all other StackOverflow solutions, this FINALLY let me install the rmagick gem. Thank you!