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...)

24 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.

blourg 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/

โลกของพวกเรา 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

just.do said...

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

Riza 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.

Riza 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!

iffi.D.S 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

Sumit 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?

Post a Comment