I am facing issues with installing rmagick in mountain lion. I have installed Xcode 4.4 and developer tools. Still facing this issue.
Installing rmagick (2.13.1) with native extensions Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Thanks!
/Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:552:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/mohit/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for clang... yes
checking for Magick-config... yes
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
--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/mohit/.rvm/rubies/ruby-1.9.3-p125/bin/ruby
/Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:193:in `<main>'
Gem files will remain installed in /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:530:in `block in build_extensions'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:505:in `each'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:505:in `build_extensions'
from /Users/mohit/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:in `install'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/source.rb:90:in `block in install'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/rubygems_integration.rb:82:in `preserve_paths'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/source.rb:89:in `install'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:73:in `block in install_gem_from_spec'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/rubygems_integration.rb:97:in `with_build_args'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:72:in `install_gem_from_spec'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:56:in `block in run'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:55:in `run'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/installer.rb:12:in `install'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/cli.rb:220:in `install'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/vendor/thor.rb:263:in `dispatch'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/lib/bundler/vendor/thor/base.rb:386:in `start'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/gems/bundler-1.1.0/bin/bundle:13:in `<top (required)>'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/bin/bundle:19:in `load'
from /Users/mohit/.rvm/gems/ruby-1.9.3-p125/bin/bundle:19:in `<main>'
I just updated to Mountain Lion this morning and had rmagick troubles. I had installed ImageMagick through homebrew at some point in the past, so this worked for me after installing the new commandline tools through xcode's preferences window.
brew update
brew uninstall ImageMagick
brew install ImageMagick
gem uninstall rmagick
gem install rmagick
I didn't have to get funky with gcc like some above posts mentioned.
I finally solved this using:
$ cd /usr/local/Cellar/imagemagick/6.8.0-10/lib
$ ln -s libMagick++-Q16.7.dylib libMagick++.dylib
$ ln -s libMagickCore-Q16.7.dylib libMagickCore.dylib
$ ln -s libMagickWand-Q16.7.dylib libMagickWand.dylib
The solution comes from https://coderwall.com/p/wnomjg
I was getting the same
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
did it as it says in https://gist.github.com/1860511
So after updating my mac pro to Mountain Lion, my ruby environment started screaming with different errors one after another. After 1-2 hours of trial - error and googling, here is how I fixed my ruby on rails environment.
First I got ruby env errors.It was not detecting git commands and Bundler was screaming with
errors when I ran foreman start
Step1 : Update XCode
. Get the latest one Xcode 4.6
Mountain Lion does not come with ruby headers installed before hand, so you need to do this manually from XCode. Go to Xcode Preferences/Downloads.
Install Command Line Tools
Step2: Install XQuartz
Logout and Login again. (You might not need this as imagemagick formula has been updated
Step 3: Now your ruby env would start speaking about Imagemagick errors Do this:
brew update
brew uninstall imagemagick
brew install --fresh imagemagick
gem uninstall rmagick 2.13.2
gem install rmagick
After trying the last one, now it will give you native extension errors like this
Installing rmagick (2.13.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/priyanka/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for /usr/bin/gcc-4.2... no
No C compiler found in ${ENV['PATH']}. See mkmf.log for details.
*** 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/priyanka/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
Gem files will remain installed in /Users/priyanka/.rvm/gems/ruby-1.9.2-p180/gems/rmagick- 2.13.1 for inspection.
Results logged to /Users/priyanka/.rvm/gems/ruby-1.9.2-p180/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
An error occured while installing rmagick (2.13.1), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.
Step 4:
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
This should fix all issues that Mountain Lion gifted you after the upgrade.
Just run bundle
.
Try changing your path such that /usr/local/bin is inserter before /usr/bin. I found this running brew doctor and it allowed me to finish compiling imagemagick.
Here is a quick summary of how I was able to get RMagick work, after several tries. I feel the following is the best way to get it without going to the pains of downloading source tarballs and compilation - leave that to experts
- You need to have Xcode and Command Line Tools installed for gcc/g++ etc. Command line tools do not get installed automatically with Xcode, go Preferences and install it
- Next install Macport
- Install Homebrew as well
- Make sure you have X11 server installed - if not install it -
sudo port install -v xorg-server
. I use-v
option as it is a long install and you might wonder whether it is doing something or just hanging - Install pkgconfig -
sudo brew install pkgconfig
- now it is time to install ImageMacick -
sudo port install -v ImageMagick
do not use brew to install ImageMagick - it does not install all the dependencies and delegates properly. - once ImageMagick is installed - set
DISPLAY
env variable -export DISPLAY=:0.0
- better still put it in your.profile
- Now test your ImageMagick installation
- start X11 server (after X11 server installation it is will there in your App List)
- from command line run -
$convert logo: logo.gif; identify logo.gif; display logo.gif
- it should pop up a window displayinglogo.gif
also run a command from command line -
$convert -list configure | grep -i delegates
. It should output the followingDELEGATES bzlib fftw fontconfig freetype gs jpeg jng lcms2 lzma png tiff x11 xml zlib
Now you should be set to run
sudo gem install RMagick
After RMagick is installed successfully - check where it is installed, go to examples directory within and run some of the programs.
No solutions were working for me, eventually I ran brew doctor
and discovered that I needed to link imagemagick with brew link --overwrite imagemagick
I had similar issue but on El Captain. Better explained here. Fixed after installing xcode command-line tools:
xcode-select --install
You need to install XCode 4.4, command line tools, etc. Check out the full listing here: http://tektastic.com/2012/07/getting-rmagic-and-friends-to-work-on.html
I found the solution for me was a combination of the steps listed above, at http://tektastic.com/2012/07/getting-rmagic-and-friends-to-work-on.html and here http://robots.thoughtbot.com/post/27985816073/the-hitchhikers-guide-to-riding-a-mountain-lion, although I didn't have to do all the steps listed in either post. But I did need to install the command line tools from XCode, I missed that detail the first few times. I also had to install gcc-4.2 using homebrew, and make a sym link to that installation in my bin directory.
I could be confused about what's going on with the different compilers, but I would be cautious about sym linking /usr/bin/gcc to /usr/bin/gcc-4.2 (which may in turn be a link to gcc-4.2 installed by homebrew). Before I realized I needed to install the command line tools, I had tried making that sym link and then I started seeing other gem build failures. Installing the command line tools fixed those issues - I believe the xcode command line tools made it a sym link to llvm-gcc-4.2.
I just installed rmagick 2.13.2 and this issue is gone.
来源:https://stackoverflow.com/questions/11676844/issue-with-installing-imagemagick-and-rmagick-on-mountain-lion