无法安装RMagick 2.13.1。找不到Magick-config。

9
$ gem install rmagick
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

        /Users/XXXXXXX/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in /Users/XXXXXXX/.rvm/gems/ruby-1.9.2-p180/bin:/Users/XXXXXXX/.rvm/gems/ruby-1.9.2-p180@global/bin:/Users/XXXXXXX/.rvm/rubies/ruby-1.9.2-p180/bin:/Users/XXXXXXX/.rvm/bin:/Users/XXXXXXX/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin

*** 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/XXXXXXX/.rvm/rubies/ruby-1.9.2-p180/bin/ruby


Gem files will remain installed in /Users/XXXXXXX/.rvm/gems/ruby-1.9.2-p180/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/XXXXXXX/.rvm/gems/ruby-1.9.2-p180/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

但是当我这样做时:

$ locate Magick-config
/opt/local/bin/Magick-config
/opt/local/share/man/man1/Magick-config.1.gz
/opt/local/var/macports/software/ImageMagick/6.6.4-9_0+q16/opt/local/bin/Magick-config
/opt/local/var/macports/software/ImageMagick/6.6.4-9_0+q16/opt/local/share/man/man1/Magick-config.1.gz
/opt/local/var/macports/software/ImageMagick/6.6.5-0_0+q16/opt/local/bin/Magick-config
/opt/local/var/macports/software/ImageMagick/6.6.5-0_0+q16/opt/local/share/man/man1/Magick-config.1.gz

有什么想法吗?

1
抱歉,我错过了你问题的第二部分。我不确定在安装 gem 时如何指定 imagemagick 的路径。MacPorts 将其放置在非标准位置,因此无法找到它。 - d11wtq
2
在终端中遇到了同样的问题,执行以下命令:export PATH=/opt/local/bin:/opt/local/sbin:$PATH,然后再运行sudo gem install rmagick,问题就可以解决了。 - Rubytastic
@Rubytastic: 这是唯一能让它工作的方法。我注意到gem安装错误信息中的PATH不包含/opt/local/bin,这是因为rvm在安装时与.bash_profile玩游戏而被删除的,而这也是macports将/opt/local/bin添加到PATH的位置。 - Bogatyr
6个回答

35
命令:sudo apt-get install libmagickwand-dev

在我的Ubuntu 10.04 LTS上运行良好。 - Code-Source

4

虽然这不是问题的答案,但在Mac上安装Imagemagick和Rmagick的推荐方式是使用homebrew。这是我在Mac上让Imagemagick和Rmagick完美协作的唯一方法。


4

对于Ubuntu(11.10+),请尝试安装libmagick++-dev软件包。

对于其他Linux发行版,请尝试安装libmagick-dev软件包。


5
实际上,在Ubuntu 12.04上,libmagick++-dev软件包的版本为8:6.6.9.7-5ubuntu3.1。 - Bruno Medeiros

3

对于我的情况,我正在安装它在Ubuntu/Linaro 4.5.2-8ubuntu3上,遇到了相同的错误,尝试安装以下两个软件包套件它就可以工作了,也许是其中一个:

sudo apt-get install graphicsmagick-libmagick-dev-compat

sudo apt-get install libmagickwand-dev


2

在Mac上,执行以下命令安装ImageMagick:

brew install imagemagick

安装完成后,别忘了链接dylibs:

brew link imagemagick


0

我必须将一个旧应用程序转移到Debian Stretch服务器上。
使用的Ruby版本是2.0.x。
已安装了ImageMagick,包括libmagickwand-dev。
尝试安装rmagick 2.13.2失败。

我不得不升级rmagick版本(修补了我的Gemfile.lock),以使用支持ruby 2.0的最后一个版本rmagick2.16.0


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接