Thursday, December 9, 2010

If you fail Install RMagick on MinGW and MSYS...

If you fail phosphorescence: Install RMagick on MinGW and MSYS, it may be the reason that convert command in extconf.rb file is overloaded with Windows File System's one. So edit the gems/rmagick-2.13.1/ext/RMagick/extconf.rb file at #171 and #178 like below:
`identify -version` =~ /Version: ImageMagick (\d+\.\d+\.\d+)-\d+ /

Then let's type the command in gems/rmagick-2.13.1 directory.
> gem build rmagick.gemspec
> gem install rmagick-2.13.1.gem --platform=ruby -- --with-opt-lib=c:/ImageMagick/6.6.6-Q16/lib --with-opt-include=c:/ImageMagick/6.6.6-Q16/include

And Now I'm requesting pulling it.


zrr said...


This seems to work for me. I just trying to install on Ruby 1.9.2 on Windows-Vista.

Yes, seems to work! Thanks!


gJetsam said...

I've been trying to get RMagick on my Windows install and this post has gotten me closer than anything else, but it's still not there. Have you ever seen this error?

C:/Ruby192/bin/ruby.exe extconf.rb --with-opt-lib=c:/ImageMagick-6.6.7-Q16/lib --with-opt-include=c:/ImageMagick-6.6.7-Q

checking for Ruby version >= 1.8.5... yes
checking for AcquireImage() in assert.h,ctype.h,stdio.h,stdlib.h,math.h,time.h,stdint.h,sys/types.h,wand/MagickWand.h...
... (Many other no and yes)

Sat 12Feb11 03:42:50
This installation of RMagick 2.13.1 is configured for
Ruby 1.9.2 (i386-mingw32) and ImageMagick 6.6.7

C:/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_RMagick2'" > RMagick2-i386-mingw32.def
make: *** No rule to make target `/C/Ruby192/include/ruby-1.9.1/ruby.h', needed by `rmagick.o'. Stop.

Youhei Kondou said...

Please check you have installed header files

Anonymous said...

Hi Youhei,

After updated the extconf.rb as you said I am still getting this problem when I try that last command line:

> gem install rmagick-2.13.1.gem --platform=ruby -- --with-opt-lib=c:/Program Files (x86)/ImageMagick-6.6.9-Q16/lib --with-opt-include=c:/Program Files (x86)/ImageMagick-6.6.9-Q16/include

Temporarily enhancing PATH to include DevKit
Building native extensions. This could take a while
ERROR: Error installing rmagick-2.13.1.gem:
ERROR: Failed to build gem native extension

C:Ruby192/bin/ruby.exe extconf.rb --with-opt-lib=c:/Program Files (x86)/ImageMagick-6.6.9-Q16/lib --with-opt-include=c:/Program Files (x86)/ImageMagick-6.6.9-Q16/include
checking for Ruby version >= 1.8.5... yes
*** extconf.rb failed ***

extconf.rb.171:in ''':No such file or directory - identify -version (Errno::ENT) from extconf.rb:171:in ''

Anonymous said...

Hi Youhei, btw, I reinstalled ImageMagick to the C:/Ruby192 folder (rather than 'Program Files (x86)' which had a space in the name) and I am still getting the same error. Please help!


Youhei Kondou said...

You should not include white space in ImageMagick path. Plz check my previous post from top sentence of this article.

Anonymous said...

Hi Youhei, I changed the directory of file and now the command is:

>gem install rmagick-2.13.1.gem --platform=ruby -- --with-opt-lib=c:/ImageMagick-6.6.9-Q16/lib --with-opt-include=c:/ImageMagick-6.6.9-Q16/include

And it is still not working. I get:
ERROR: Error installing rmagick-2.13.1.gem:
ERROR: Failed to build gem native extension

Checking for Ruby version>= 1.8.5... yes
*** extconf.rb failed ***

lower down I get the line:
extconf.rb:171:in ''': No such file or directory - identify -version (Errno::ENOENT)
from extconf.rb:171:in '(main)'

Anonymous said...

Thanks Youhei, got it to work now. Thanks!

Duke of Earl said...

Hey I am having the same problem as da33a6fe what was the solution that you gave him to finally get it to work ?

Youhei Kondou said...

Plz check my previous post from top sentence of this article.
I guess you should check PATH

Daniel Connolly said...

Hi I was following the guide to installing rmagick and this one and everything seemed to work there but when i tried to fire up my rails server i'm getting the error CORE_RL_magick_.dll is missing. Can anybody help with this? The file is there and my paths are all set to whatever they are in the link above.

Youhei Kondou said...

As like in, set the PATH for ImageMagick install root.

Youhei Kondou said...

I now recommend that all you should use mini_magick rather than RMagick, see my past article.

Anonymous said...

thx. looks like it solved my problem!
(Though I installed ImageMagick to the default "Program Files (x86)" folder, it worked using the Progra~2 short form. )

Anonymous said...

You can get rmagick to compile on Windows with the command:

gem install rmagick -- '--with-opt-dir="[path to ImageMagick]"'

There are three noteworthy things about this command:

1. There's a double-dash separating "rmagick" and the --with-opt-dir option
2. The --with-opt-dir option is surrounded by single-quotes
3. The path to the ImageMagick directory is surrounded by double-quotes

You can have spaces in the path to the ImageMagick directory if you use this syntax.

You also have to make sure of two other things:

1. ImageMagick was installed with the development headers option (installs lib and include directories)
2. ImageMagick is first in your system path

If ImageMagick isn't first in your system path, you'll get an "Invalid drive specification" error when extconf.rb tries to identify the ImageMagick version.

All that said, I've experienced failures to build with some version pairings of rmagick and ImageMagick. I was able to get ImageMagick 6.7.7 and rmagick 2.13.0 to build together on both Windows 7 and Server 2003.

Anonymous said...

Think I meant 2.13.1 on the rmagick gem.

DantaliaN said...

install ImageMagic. Path without spaces. Exampl C:/ImageMagick-6.8.3-Q16

unzip RMagic anywhere

in \RMagick-2.12.0\ext\RMagick\extconf.rb
rem on line 150
#abort "Unable to get ImageMagick version" unless $1
and set ani version
$magick_version = "ImageMagick 6.8.3"

gem install rmagick-2.12.0.gem --platform=ruby -- --with-opt-lib=C:/ImageMagick-6.8.3-Q16/lib --with-opt-include=C:/ImageMagick-6.8.3-Q16/include

Tim said...

Hi I am still getting the same error as the guys above in relation to

extconf.rb:171:in ``': No such file or directory - identify -version (Errno::ENO
from extconf.rb:171:in `'

How to solve it ?

Youhei Kondou said...

Type identify in your command prompt.

If there is no ImageMagick itself or there is another identify command, please install ImageMagick itself correctly.

Nguyễn Cao Phúng said...

@DantaliaN's comment help me install rmagick successfully.
Thank DantaliaN!

seenu said...

Thx a lot this tutorial helped me to install it in 10mins, when i spent around hours & was not able to install.

Steven Machtelinckx said...

Thank you, this worked for me!

Post a Comment