Tuesday, October 5, 2010

Install RMagick on MinGW and MSYS

Currently, Windows Rubyist is installing RMagick from here. But there are 3 problems.
  1. Not latest RMagick version
  2. Not latest Ruby version
  3. Not latest bundled ImageMagick

But we are already having Ruby Devkit (MinGW). So let's get latest RMagick on Windows.

Install ImageMagick

After downloading from here, launch the installer. Then select the option to install C/C++ header files.
At last, set the PATH for ImageMagick install root if not.

Install RMagick

For instance, ImageMagick is installed in c:/ImageMagick/6.6.4-Q16.
(Append at 2010/10/18) Install path should not be contained whitespace
$ gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick/6.6.4-Q16/lib --with-opt-include=c:/ImageMagick/6.6.4-Q16/include
That's all! to be continued...(If you fail Install RMagick on MinGW and MSYS...)

27 comments:

Bill said...

Thank you! Just what I needed to help get the latest version of Refinery CMS going.

Matthew said...

It is important to install imagemagick to a path that does not contain a space like C:\Program Files as the author did in his example, otherwise that rmagick install will not work. Thanks for the article, very nice!

Youhei Kondou said...

Hi, Bill. I'm glad to be of help.

Youhei Kondou said...

Hi, Matthew. Thanks for telling me the important thing. I add the append now.

Benoit Caccinolo said...

Here is my tutorial to install RMagick on a Mac
http://bcaccinolo.wordpress.com/2010/11/09/install-rmagick-on-mac-os-x/

Youhei Kondou said...

It's fine!

WaYdotNET said...

RMagick on Ruby 1.9.1 (i386-mingw32)
http://www.waydotnet.com/blog/2010/02/rmagick-on-ruby-1-9-1-i386-mingw32-work-d/

Unknown said...

Thanks a lot to this post, this save my day

zrr said...

I am doing gem install rmagick --platform=ruby -- --with-opt-lib=C:\ImageMagick6.6.7-Q16\lib --with-opt-include=C:\ImageMagick\6.6.7-Q16\include

but that results in

checking for wand/MagickWand.h

but the file is there, I can see it.

Any hints?

Best
Zeno

Youhei Kondou said...

Hi, zrr. Please re-check you are setting C:\ImageMagick6.6.7-Q16 to the PATH.

zrr said...

Dear Youhei-san

Does it not suffice to click the check-box in the installer "Add Application Directory to your system Path" or does that not suffice and do I also have to add C:\ImageMagick6.6.7-Q16 manually to the Path as well?

The Install-Path should not contain whitespaces, that I understand.

Best
Zeno

Youhei Kondou said...

Okay, zrr-san. Is your whole error message like below?
http://old.nabble.com/Can%27t-install-RMagick-due-to-MagickWand-problems-td24323187.html

That is not because of wand/MagickWand.h . It's because of fail in extconf.rb .

Please check my another article:
http://phosphor-escence.blogspot.com/2010/12/if-you-fail-install-rmagick-on-mingw.html

Anonymous said...

Yes, that was the error, correct. I will try it again asap.

Unknown said...

Hi

I tried to follow this tutorial and also combined with http://www.waydotnet.com/blog/2010/02/rmagick-on-ruby-1-9-1-i386-mingw32-work-d/#comment-144895279

After done all the settings and began to install the RMagick, suddenly I got this message

" cheking for stdint.h... *** extconf.rb failed *** "

Do you have any suggestion about this issue?

Youhei Kondou said...

(1)
Please check you have installed header files
http://4.bp.blogspot.com/_Gc38Wa77_EY/TJ3Um4HiT6I/AAAAAAAAAPA/-s3e2F7tx8k/s1600/imagemagick_installer.png

(2)
Please re-install your MinGW correctly.

Unknown said...

Thanks Youhei
I did it right now :)
I combined your way and WayDotNet(http://www.waydotnet.com/blog/2010/02/rmagick-on-ruby-1-9-1-i386-mingw32-work-d/#comment-144895279) way

Now I made the tutorial base on your tutorial and WayDotNet tutorial in my language at http://www.megenep.com/article/507/instalasi-rmagick-untuk-rails-3-pada-windows

james said...

this was the solution I was looking for after hours of trying other how-tos. Thank you!

Aftab Khalid said...

Dear Youhei,

I am facing following error please help me out.
my ruby version is:ruby 1.9.2p290
my rails version is: Rails 3.2.1

C:\Users\Aftab>gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick/6.7.4-Q16/lib --with-opt-include=c:/ImageMagick/6.7.4-Q16/include
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.

C:/RubyOnRails/Ruby1.9.2/bin/ruby.exe extconf.rb --with-opt-lib=c:/ImageMagick/6.7.4-Q16/lib --with-opt-include=c:/ImageMagick/6.7.4-Q16/include
checking for Ruby version >= 1.8.5... yes
Invalid drive specification.
Unable to get ImageMagick version
*** 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=${opt-dir}/include
--with-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/RubyOnRails/Ruby1.9.2/bin/ruby


Gem files will remain installed in C:/RubyOnRails/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1 for inspection.
Results logged to C:/RubyOnRails/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

Really thanks in advance.

Youhei Kondou said...

Please check the log file on C:/RubyOnRails/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1/ext/RMagick/gem_make.out

Brandsmith said...

Many thanks, Youhei!
got rmagick installed correctly on my machine after installing imagemagick on a path with no spaces.

Informatics said...

I'm facing the following problem please guide me

C:/Ruby187/bin/ruby.exe extconf.rb --with-opt-lib=c:/ImageMagick/6.7.9-q16/lib --wiht-opt-include=c:/ImageMagick/6.7.9-q16/include
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... no
checking for sys/types.h... no
checking for wand/MagickWand.h... no

Can't install RMagick 2.13.1. Can't find MagickWand.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=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby187/bin/ruby

Youhei Kondou said...

Install ImageMagick with header files

http://4.bp.blogspot.com/_Gc38Wa77_EY/TJ3Um4HiT6I/AAAAAAAAAPA/-s3e2F7tx8k/s1600/imagemagick_installer.png

Moncho said...

iffi.D.S ... I got the same this is gem_make.out

C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-opt-lib=C:\ImageMagick-6.8.4-Q16\lib --with-opt-include=C:\ImageMagick-6.8.4-Q16\include
checking for Ruby version >= 1.8.5... 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=${opt-dir}/include
--with-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/RailsInstaller/Ruby1.9.3/bin/ruby
C:/RailsInstaller/Ruby1.9.3/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 C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:194:in `'

Youhei Kondou said...

(1) Are you installing ruby DevKit?
(2) Are you installing ImageMagick header files?

Unknown said...

Hi

Unknown said...

I am not able to install the rmagick even after installing ImageMagick . I was able to verify ImageMagick installing by issuing the command "identify --version". I followed the other link of yours:http://phosphor-escence.blogspot.in/2010/12/if-you-fail-install-rmagick-on-mingw.html , but i am not able to find gemspec file in that path and it is also throwing an error. Please help me resolving this error.

C:\Sites\konavsa>gem install rmagick --platform=ruby -- --with-opt-lib=C:\ImageM
agick-6.9.1-Q16\lib --with-opt-include=C:\ImageMagick-6.9.1-Q16\include
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.

C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb --with-opt-lib=C:\Im
ageMagick-6.9.1-Q16\lib --with-opt-include=C:\ImageMagick-6.9.1-Q16\include
*** 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=${opt-dir}/include
--with-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/RailsInstaller/Ruby1.9.3/bin/ruby
C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:
36:in `require': cannot load such file -- rmagick/version (LoadError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custo
m_require.rb:36:in `require'
from extconf.rb:8:in `'
from extconf.rb:7:in `'
from extconf.rb:6:in `'


Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9
.1/gems/rmagick-2.15.2 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rmagick-2
.15.2/ext/RMagick/gem_make.out

seo company in mumbai said...


Such a wonderful information blog post on this topic provides assignment service at affordable cost in a wide range of subject areas for all grade levels, we are already trusted by thousands of students who struggle to write their academic papers and also by those students who simply want Assignment helpto save their time and make life easy.
Ruby assignment help

Post a Comment