Ruby on Rails RMagick on Windows 7

First and most important, when reporting issues or asking for help, always include version information about what you're trying to install, specially Ruby.

It seems you're installing using RailsInstaller, but since you didn't mention if is the 2.0 preview version or the stable one, I'll assume you used the stable one, which is based on Ruby 1.8.7-p334.

Now, RailsInstaller already includes the needed pieces: Ruby and RubyInstaller DevKit component, so going to skip the steps about installation of that and jump directly to RMagick itself.

To successfully install RMagick gem, you need ImageMagick binaries with development headers, as documented in RubyInstaller's Tutorial wiki page, which links here

Please download 32bits version of ImageMagick, as Ruby is 32bits.

For my test I've downloaded the installer version ImageMagick-6.7.0-8-Q16-windows-dll.exe

Once downloaded and installed in a path without spaces and I've selected the option Install development headers and libraries for C and C++.

Then open a new Command Prompt, ensure Ruby is available (checking with ruby -v) and after performed the following command:

gem install rmagick --platform=ruby -- --with-opt-lib=C:\ImageMagick-6.7.0-Q16\lib --with-opt-include=C:\ImageMagick-6.7.0-Q16\include

That command is going to take considerable amount of time (took 1 minute on my Core 2 Duo) but the end result was:

Fetching: rmagick-2.13.1.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
Successfully installed rmagick-2.13.1
1 gem installed

Now you can verify RMagick installed successfully using IRB:

irb(main):001:0> require "rubygems"
=> true
irb(main):002:0> require "rmagick"
=> true
irb(main):003:0> Magick::Version
=> "RMagick 2.13.1"

Now, if you're using Ruby 1.9.2, last RMagick release is not compatible with it and you will need to build from source. There is another tutorial on RubyInstaller wiki that covers that, but please read this thread at RubyInstaller group were we discuss the issues.

Hope all this helps.


This above post did not work for me, the key for me was using GitBash wich comes with RailsInstaller, and also includes Devkit.

Install railsinstaller -> www.railsinstaller.org (I installed it to c:\Rails)
Install ImageMagick -> ImageMagick-6.7.3-8-Q16-windows-dll.exe (I installed it to c:\ImageMagick)

Open GitBash

$ gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick/lib --with-opt-include=c:/ImageMagick/include


Temporarily enhancing PATH to include DevKit...
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...

Also, in the gemfile I have commented out gem 'rmagick' in the development group

This is what my gemfile looks like

group :development do #this is used on localhost
 gem 'mysql2'
 gem 'paperclip'
 #gem 'rmagick' #dont need this
 gem 'devise'
end



group :production do #this is used on heroku
 gem "pg" #this is postgresql used on heroku
 gem "aws-s3" #this is used for amason S3 filestorage

 gem 'paperclip'
 gem 'rmagick'
 gem 'devise'
end

We just had this problem with Windows 7, Ruby 2.0 & Rails 4.0

This tutorial works really well:

  1. Download the latest ImageMagick installer from ImageMagick.org (as of writing, "[ImageMagick-6.8.7-0-Q16-x86-dll.exe][3]" -- the complete installer (not the binaries))

  2. Once downloaded, install ImageMagick without any white spaces in the file path (E.G C:/ImageMagick) with the following options checked:

  • Add Application Directory To Your System Path
  • Installer Development Headers For Libraries C & C++
  1. In the Ruby CMD, install the RMagick Gem with the correct file paths:

gem install rmagick --platform=ruby -- --with-opt-lib=**c:/ImageMagick-6.7.0-Q16/lib** --with-opt-include=**c:/ImageMagick-6.7.0-Q16/include**

This should work for you