我正在尝试在我的Mac OS X v10.9(Mavericks)机器上安装rmagick。但是,我遇到了这个错误。
/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.
Magick-config中的41、17、50、53行是:
--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
;;
我使用
brew install imagemagick --build-from-source
安装了ImageMagick,然后在运行gem install rmagick
之前,我使用export PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.8.9-1/lib/pkgconfig
设置了MagickCore.pc的路径以及使用export C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.8.9-1/include/ImageMagick-6/
设置了Wand.h的路径。这对于Wand有效,但对于MagickCore无效,因为我仍然收到“pkg-config:command not found”的错误。我使用Ruby 1.9.3p545和Ruby on Rails 3.2.16。
如何解决这个问题?
pkg-config
或更新PATH
以包含它的位置。从源代码构建时,需要在系统上安装此实用程序。 - emcconvillepkg-config
已经随 Homebrew 安装好了。你想让我更新哪个PATH
? - Minh Tri Phampkg-config
在你指定的位置吗?使用which pkg-config
进行检查。对我来说,在 macOS 10.7.5 上,它位于/usr/local/bin/pkg-config
。 - Eric Baldwin