问题
On Ruby 1.8.7 and rails 2.3.5 I get:
gem install rmagick
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Building native extensions. This could take a while...
Cynicalgrinch:levelous pawel$ gem install rmagick
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
Gem_make.out says this:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
回答1:
To install rmagick with the gem system, you must have "imagemagick" on your system. The following error line says that rmagick failed to build because the native extension (imagemagick) does not exist on your system.
ERROR: Failed to build gem native extension.
On OSX, you can use brew (the best way in my opinion) to install imagemagick. Once brew is installed :
brew install imagemagick
gem install rmagick
On Mountain Lion (OSX), after:
brew install imagemagick
it may be necessary to force the re-creation of some symlinks manually before being able to install the rmagick gem.
> brew link -f jpeg
> brew link -f libpng
> brew link -f freetype
> brew link -f imagemagick
回答2:
on Ubuntu/Debian you would need to install:
sudo apt-get install libmagickwand-dev
on RedHat/Fedora/CentOS:
yum install ImageMagick-devel
回答3:
On fedora make sure you have ImageMagick-devel
installed.
来源:https://stackoverflow.com/questions/5415243/why-am-i-having-a-problem-installing-rmagick