I am a beginner to RoR & trying to setup Netbeans IDE. Could someone please help me with the bundler error for rmagick in Netbeans ?
I have the following environment for ROR development:
Qadeers-MacBook:gems Qadeer$ rvm info
ruby-1.9.3-p194:
system:
uname: "Darwin Qadeers-MacBook.xxxxxx.com 11.4.0 Darwin Kernel Version 11.4.0"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"
rvm:
version: "rvm 1.15.5 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "21 hours 49 minutes 4 seconds ago"
ruby:
interpreter: "ruby"
version: "1.9.3p194"
date: "2012-04-20"
platform: "x86_64-darwin11.4.0"
patchlevel: "2012-04-20 revision 35410"
full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]"
homes:
gem: "/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194"
ruby: "/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194"
binaries:
ruby: "/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
irb: "/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
gem: "/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
rake: "/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194@global/bin/rake"
environment:
PATH: "/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194/bin:/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194@global/bin:/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/Qadeer/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/Cellar/ruby/1.9.3-p194/bin:/usr/X11/bin:/usr/local/git/bin"
GEM_HOME: "/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194"
GEM_PATH: "/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194:/Users/Qadeer/.rvm/gems/ruby-1.9.3-p194@global"
MY_RUBY_HOME: "/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194"
IRBRC: "/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
RUBYOPT: ""
gemset: ""
I am using Netbeans IDE 6.9.1 and have a gem dependency of
gem "rmagick", ">= 1.15.17"
When i use bundler to install the dependencies in my gemfile, it fails with an error
Installing rmagick (2.13.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/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 /usr/bin/gcc-4.2... yes
checking for Magick-config... no
Can't install RMagick 2.13.1. Can't find Magick-config in /usr/bin:/bin:/usr/sbin:/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
--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/Qadeer/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
Gem files will remain installed in /Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/Qadeer/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/gems/1.9.1/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.
So, i directly installed the gem successfully using the command
Qadeers-MacBook:gems Qadeer$ gem install rmagick -v '2.13.1'
Building native extensions. This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed
Installing ri documentation for rmagick-2.13.1...
Installing RDoc documentation for rmagick-2.13.1...
Note that although the above was successful, i still cannot see the gem listed in the installed list of gems in netbeans ruby platforms screen. Not sure why..
I know already that ImageMagick is installed on my machine
Qadeers-MacBook:gems Qadeer$ ruby -rRMagick -e "puts Magick::Long_version"
This is RMagick 2.13.1 ($Date: 2009/12/20 02:33:33 $) Copyright (C) 2009 by Timothy P. Hunter
Built with ImageMagick 6.7.7-6 2012-08-23 Q16 http://www.imagemagick.org
Built for ruby 1.9.3
Web page: http://rmagick.rubyforge.org
Email: rmagick@rubyforge.org
Doing a locate on the Magick-config file results in the following paths, because it was installed using brew.
Qadeers-MacBook:gems Qadeer$ locate Magick-config
/usr/local/Cellar/imagemagick/6.7.7-6/bin/Magick-config
/usr/local/Cellar/imagemagick/6.7.7-6/share/man/man1/Magick-config.1
/usr/local/bin/Magick-config
/usr/local/share/man/man1/Magick-config.1
The question is, how do i tell netbeans to use the Magick-config from the above path instead of just looking at /usr/bin:/bin:/usr/sbin:/sbin ?
Any help is much appreciated..!
And here's the answer.. !!! Just minutes after i posted it, i found this link which is in chinese. Although i dont speak chinese, i could only follow the screens and updated the config file and restarted netbeans. And voila the change works. The solution was just that Netbeans required the extended path variable for /usr/local/bin which has the Magick-config file present. Once this was done, the IDE was able to install rmagick. Thanks and hope this would be useful for someone later on..