3

Note: my situation is almost identical to this: Can't install pg gem on Mountain Lion.

I just upgraded from Snow Leopard to Mountain Lion and Rails is giving me all kinds of problems, especially trying to install the 'rmagick' gem. I'm running Ruby 1.9.3-p362 and Rails 3.2.11.

➜  git:(master) ✗ sudo gem install rmagick -v 2.13.1
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

        /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc-4.2... yes
checking for Magick-config... yes

Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
         /opt/local/bin/Magick-config reports version 6.6.6 Q8 is installed in /opt/local
         /OPT/LOCAL/BIN/Magick-config reports version 6.6.6 Q8 is installed in /opt/local
         /USR/LOCAL/BIN/Magick-config reports version 6.8.0 Q16 is installed in /USR/LOCAL/Cellar/imagemagick/6.8.0-10
Using 6.6.6 Q8 from /opt/local.

checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.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
    --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/sscirrus/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
/Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
    from /Users/sscirrus/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
    from extconf.rb:193:in `<main>'


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

➜  applyco git:(master) ✗ brew install imagemagick --disable-openmp
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
Error: imagemagick-6.8.0-10 already installed

➜  applyco git:(master) ✗ apt-get install libmagick9-dev
zsh: command not found: apt-get

I have tried:

  • Installing Xcode with command line tools
  • Reinstalling homebrew
  • Clearing out all my repo's gems (including Gemfile.lock) and running bundle install
  • Reinstalling the bundler gem
  • Reinstalling ImageMagick

Nothing, including answers elsewhere on SO, have been of any use. Can you point me in the right direction?

4

4 に答える 4

2

RoR 3.2.11 用に Mountain Lion で私の開発環境をセットアップしたときと同じ問題がありました。RMagick の最新バージョン (2.13.1) は、ImageMagick の最新バージョン (6.8.2-0) でのコンパイルがうまくいかないようです。openmpを無効にしてソースからビルドすると、えーと..Magickのように機能しました。

brew uninstall imagemagick
brew install imagemagick --disable-openmp --build-from-source
gem install rmagick

http://blog.paulopoiati.com/2013/01/28/installing-rmagick-in-mac-os-x-mountain-lion-with-homebrew/に記載されている醸造式を編集する必要はありませんでしたが、それが次のステップです。

于 2013-03-12T20:48:16.780 に答える
1

私はここで同じ問題を経験しています...しかし、1つの違いは、自作が別のバージョンのImagemagickにリンクされている可能性があることです。

そのため、imagemagick-6.8.0-10 がインストールされていても見つかりません。

そのようなことを試してみて brew unlink imagemagickbrew link imagemagick 何が起こるか見てください。

これで問題が解決 しましたhttp://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion

于 2013-01-24T06:08:35.043 に答える
1

初めて Rails 3 で Paperclip を使用しようとしたときに、同じ問題が発生しました。以前の回答を要約すると、私にとってうまくいったのは次のとおりです。

sudo chown -R `whoami` /usr/local
brew link --overwrite imagemagick

ありがとう!

于 2013-06-17T02:10:12.377 に答える
1

パーミッションの問題かもしれません 実行してみてください

sudo chown -R `whoami` /usr/local

してから再試行してください。

于 2013-06-08T12:52:50.963 に答える