首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Rails:安装rmagick时出错-错误:无法构建gem本机扩展

Rails:安装rmagick时出错-错误:无法构建gem本机扩展
EN

Stack Overflow用户
提问于 2013-10-09 22:02:43
回答 17查看 60.3K关注 0票数 62

我正试图在我的本地机器上运行一个项目。我在Mac OS系统上安装了Ruby和Rails。它工作正常。我可以创建一个新的项目,并可以正确地运行它没有任何错误,但当我试图运行现有的项目时,它告诉我,我们必须bundle install。当我运行该命令时,我得到以下错误:

代码语言:javascript
复制
"An error occurred while installing rmagick (2.13.2), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling."

当我运行gem install rmagick -v '2.13.2'时,它给出了以下错误:

代码语言:javascript
复制
ERROR:  Error installing rmagick:
ERROR: Failed to build gem native extension.

/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc-4.2... yes
checking for Magick-config... no
Can't install RMagick 2.13.2. Can't find Magick-config in /usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin

*** 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=/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rmagick-2.13.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rmagick-2.13.2/ext/RMagick/gem_make.out

我已经找过了,也没有找到答案。

EN

回答 17

Stack Overflow用户

发布于 2014-06-03 10:40:28

对于Ubuntu,我使用了ff。基于此link

代码语言:javascript
复制
$ sudo apt-get install libmagick++-dev
票数 83
EN

Stack Overflow用户

发布于 2014-08-19 08:53:37

在mac上(以下代码在OSX Mavericks上有效):

代码语言:javascript
复制
brew install imagemagick
gem install rmagick
票数 49
EN

Stack Overflow用户

发布于 2017-11-23 09:12:15

在Mac上你可以尝试这样做:

代码语言:javascript
复制
$ brew unlink imagemagick
$ brew install imagemagick@6 && brew link imagemagick@6 --force
$ gem install rmagick 
票数 44
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19274293

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档