1

Windows Vista, Ruby v. 3.3.5

C:\>gem install rmagick

Building native extensions.  This could take a while...

ERROR:  Error installing rmagick:
        ERROR: Failed to build gem native extension.

C:/Ruby19/bin/ruby.exe extconf.rb
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
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/Ruby19/bin/ruby


Gem files will remain installed in C:/Ruby19/lib/ruby/gems/1.9.1/gems/rmagick-2.
12.2 for inspection.
Results logged to C:/Ruby19/lib/ruby/gems/1.9.1/gems/rmagick-2.12.2/ext/RMagick/
gem_make.out
scarysnow
  • 65
  • 1
  • 2
  • 5

4 Answers4

5

On Windows, you should use the rmagick-win32 gem.

http://rmagick.rubyforge.org/install-faq.html#win

mopoke
  • 10,555
  • 1
  • 31
  • 31
2

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. I think the path also doesn't care about forward or backward slashes, but I use backslashes.

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.1 to build together on both Windows 7 and Server 2003.

Binary Phile
  • 2,538
  • 16
  • 16
  • I added the correct variables to set in the windows environment. **This is the best answer I found on stackoverflow** to fix the rmagick gem problem. The important aspect are the single and double quotes on the `gem install rmagick` command as shown above! – Patrick Hillert Mar 10 '13 at 15:56
  • Thanks for the vote of confidence. Not to take the wind out of anyone's sails, but I've found that expending a whole lot of effort trying to get rails working on windows with workarounds such as this one really isn't worth it. I recommend running rails on an ubuntu vm to be a much better solution than windows (preferably with vagrant). That's coming from me as a windows guy. I've got [a post](http://www.binaryphile.com/spree/a-vagrant-box-for-spree-development/) on how to use vagrant for rails development. – Binary Phile Mar 11 '13 at 14:39
1

Download this rmagick-2.13.2.gem gem and save in you local.

Open the repository in cmd prompt where the gem file is located and run the following cmd

gem install rmagick-2.13.2.gem --platform=ruby --with-opt-lib=C:/ImageMagick-6.6.7-Q16/lib --with-opt-include=c:/ImageMagick-6.6.7-Q16/include
Selvamani
  • 7,434
  • 4
  • 32
  • 43
-1

A simple google search yielded one very promising result: rmagick on windows. By the way, I guess you are using something like Ruby 1.8.5/1.8.7, but surely not 3.3.5 ( if you do, please let me join you in your time-travel adventures. We could be friends! )

moritz
  • 2,448
  • 1
  • 20
  • 25