我正在安装rmagick宝石在OSX 10.6.8,使用gem安装rmagick,我收到以下错误
Can't install RMagick 2.13.1. 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 --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/disaacs/.rvm/rubies/ruby-1.9.3-p125/bin/ruby Gem files will remain installed in /Users/disaacs/.rvm/gems/ruby-1.9.3-p125/gems/rmagick-2.13.1 for inspection. Results logged to /Users/disaacs/.rvm/gems/ruby-1.9.3-p125/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
看看mkmf.log文件我看到
have_header: checking for wand/MagickWand.h... -------------------- no "/usr/bin/gcc-4.2 -E -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1/ruby/backward -I/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/include/ruby-1.9.1 -I. conftest.c -o conftest.i" conftest.c:3:29: error: wand/MagickWand.h: No such file or directory
这是真的.在gcc-4.2命令的-I指令特定的任何目录中找不到文件MagickWand.h.为什么不?我该怎么解决这个问题?
ImageMagick已安装,使用自制软件.如果我搜索我的驱动器,我发现MagicWand.h安装在/usr/local/Cellar/imagemagick/6.7.7-6/include/ImageMagick/wand/MagickWand.h中.
我已经尝试了所有的建议在Can’t install RMagick 2.13.1. Can’t find MagickWand.h.,但没有一个工作.
编辑:
另外要注意的是:我原来是使用MacPorts安装了ImagMagick 6.7.0-7,而且安装的RMagick很好.除了它不适用于CarrierWave宝石.所以我卸载了MacPorts并卸载了RMagick.然后使用brew install -f imagemagick –disable-openmp重新安装ImageMagick,并尝试重新安装rmagick gem(这使我感到目前的问题).我在每个步骤重新启动所有终端,以确保我的路径被刷新.
解决方法
对于基于Debian的(例如Ubuntu)系统,您可以尝试,
sudo apt-get install libmagickcore-dev libmagickwand-dev gem install rmagick
它适用于我
从ruby-forum找到解决方案