无法在OSX上安装rmagick Gem

时间:2018-02-15 23:41:26

标签: ruby rmagick

我错过了什么?

继承我对imagemagick的酿造信息

❯ brew info imagemagick
imagemagick: stable 7.0.7-22 (bottled), HEAD
Tools and libraries to manipulate images in many formats
https://www.imagemagick.org/
/usr/local/Cellar/imagemagick/7.0.7-22 (1,527 files, 23.3MB) *
  Poured from bottle on 2018-02-15 at 15:36:50
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/imagemagick.rb
==> Dependencies
Build: pkg-config ✔
Required: libtool ✔, xz ✔
Recommended: jpeg ✔, libpng ✔, libtiff ✔, freetype ✔
Optional: fontconfig ✘, little-cms ✘, little-cms2 ✘, libwmf ✘, librsvg ✘, liblqr ✘, openexr ✘, ghostscript ✘, webp ✘, openjpeg ✘, fftw ✘, pango ✘, perl ✘
==> Requirements
Optional: x11 ✘
==> Options
--with-fftw
    Compile with FFTW support
--with-fontconfig
    Build with fontconfig support
--with-ghostscript
    Build with ghostscript support
--with-hdri
    Compile with HDRI support
--with-liblqr
    Build with liblqr support
--with-librsvg
    Build with librsvg support
--with-libwmf
    Build with libwmf support
--with-little-cms
    Build with little-cms support
--with-little-cms2
    Build with little-cms2 support
--with-opencl
    Compile with OpenCL support
--with-openexr
    Build with openexr support
--with-openjpeg
    Build with openjpeg support
--with-openmp
    Compile with OpenMP support
--with-pango
    Build with pango support
--with-perl
    Compile with PerlMagick
--with-webp
    Build with webp support
--with-x11
    Build with x11 support
--with-zero-configuration
    Disables depending on XML configuration files
--without-freetype
    Build without freetype support
--without-jpeg
    Build without jpeg support
--without-libpng
    Build without libpng support
--without-libtiff
    Build without libtiff support
--without-magick-plus-plus
    disable build/install of Magick++
--without-modules
    Disable support for dynamically loadable modules
--without-threads
    Disable threads support
--HEAD
    Install HEAD version

尝试安装时,我的宝石信息是

❯ gem install rmagick -v '2.13.2'
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

    current directory: /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/gems/rmagick-2.13.2/ext/RMagick
/Users/joshchernoff/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20180215-65975-100ukqk.rb 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.2. Can't find Magick-config in /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/bin:/Users/joshchernoff/.rvm/gems/ruby-2.3.1@global/bin:/Users/joshchernoff/.rvm/rubies/ruby-2.3.1/bin:/Users/joshchernoff/.rvm/bin:/Users/joshchernoff/.asdf/bin:/Users/joshchernoff/.asdf/shims:.git/safe/../../bin:/Users/joshchernoff/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/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
    --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/joshchernoff/.rvm/rubies/ruby-2.3.1/bin/$(RUBY_BASE_NAME)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/extensions/x86_64-darwin-17/2.3.0/rmagick-2.13.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/gems/rmagick-2.13.2 for inspection.

日志文件

❯ cat /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/extensions/x86_64-darwin-17/2.3.0/rmagick-2.13.2/gem_make.out
current directory: /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/gems/rmagick-2.13.2/ext/RMagick
/Users/joshchernoff/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20180215-65975-100ukqk.rb 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.2. Can't find Magick-config in /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/bin:/Users/joshchernoff/.rvm/gems/ruby-2.3.1@global/bin:/Users/joshchernoff/.rvm/rubies/ruby-2.3.1/bin:/Users/joshchernoff/.rvm/bin:/Users/joshchernoff/.asdf/bin:/Users/joshchernoff/.asdf/shims:.git/safe/../../bin:/Users/joshchernoff/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/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
    --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/joshchernoff/.rvm/rubies/ruby-2.3.1/bin/$(RUBY_BASE_NAME)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/extensions/x86_64-darwin-17/2.3.0/rmagick-2.13.2/mkmf.log

extconf failed, exit code 1

mk文件

❯ cat /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/extensions/x86_64-darwin-17/2.3.0/rmagick-2.13.2/mkmf.log
checking for Ruby version >= 1.8.5... -------------------- yes

--------------------

find_executable: checking for gcc... -------------------- yes

--------------------

find_executable: checking for Magick-config... -------------------- no

--------------------

Can't install RMagick 2.13.2. Can't find Magick-config in /Users/joshchernoff/.rvm/gems/ruby-2.3.1@impact-nw/bin:/Users/joshchernoff/.rvm/gems/ruby-2.3.1@global/bin:/Users/joshchernoff/.rvm/rubies/ruby-2.3.1/bin:/Users/joshchernoff/.rvm/bin:/Users/joshchernoff/.asdf/bin:/Users/joshchernoff/.asdf/shims:.git/safe/../../bin:/Users/joshchernoff/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Postgres.app/Contents/Versions/latest/bin

1 个答案:

答案 0 :(得分:2)

日志文件说明错误:Can't find Magick-config in [PATH]

因此,找到文件系统上的Magick-config文件,并将其放在路径中,例如:通过运行

locate Magick-config

对我而言:

/usr/local/Cellar/imagemagick@6/6.9.9-34/bin/Magick-config

如果您无法在任何地方找到Magick-config文件,请找出您没有的文件。

即使你遇到了这个错误,你仍然无法让rmagick工作,因为还不支持ImageMagick 7。 相关的Github问题:

另外,这是另一个解释如何使其工作的StackOverflow答案:ImageMagick 7 with RMagick 2.16 on MacOS Sierra Can't find MagickWand.h