17

I'm currently upgrading an old rails app to use Rails 3 and Ruby 1.9.2, and RMagick is the last gem I need to install. However there doesn't seem to be any 1.9.2 downloads for Windows and the standard gem install RMagick doesn't work.

Could someone point me in the right direction on how to install this gem?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
jon morgan
  • 171
  • 1
  • 1
  • 3
  • Late at the party. Check out this [answer](http://stackoverflow.com/a/39513938/1903781) on how to install `rmagik` on windows 10. – Adrian Moisa Sep 15 '16 at 14:46

6 Answers6

42

I just installed RMagick 2.13.1 successfully on Windows with Ruby v1.9.x !

Let me spill out the procedure, before I forget.

  1. Install DevKit : https://github.com/oneclick/rubyinstaller/wiki/Development-Kit .
  2. Install ImageMagick 6.6.x with windows installer with headers.
    NOTE:
    -Do not install ImageMagick in a path which has spaces in it.
    The default path C:/Program Files/... will not work.
    Install it at a simpler path.
    -- Remove any older installations of ImageMagick and RMagick
  3. Set the paths in Environment Variables:

    set DFImageMagick environment variable to where ImageMagick is installed
    set PATH=%DFImageMagick%;%PATH% (if you don't already have it in PATH)
    set CPATH=%DFImageMagick%\include;%CPATH%
    set LIBRARY_PATH=%DFImageMagick%\lib;%LIBRARY_PATH%

  4. Install RMagick gem : gem install rmagick
    This should say, Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... After some time, Successfully installed rmagick 2.13.1

  5. Verify installation:

    A. convert -version
    this should give the ImageMagick installation version
    B. gem list --local should list rmagick 2.13.1
    Alternative: in irb, try
    require 'rmagick'
    it should return 'true'

Oh, I do like installations which complete in 5 steps.

Hope this works for you and others.

ref:

http://www.ruby-forum.com/topic/204353#new

http://www.waydotnet.com/blog/2010/02/rmagick-on-ruby-1-9-1-i386-mingw32-work-d/#link text

Srividya Sharma
  • 778
  • 1
  • 7
  • 16
  • Thanks. Worked for me. p.s. windows installers for ImageMagick are here http://www.imagemagick.com/www/binary-releases.html#windows – jenson-button-event Feb 18 '11 at 13:04
  • This solution also works with the latest ImageMagick (ImageMagick 6.7.0-6 2011-06-07 Q16). Thanks! – The-MeLLeR Jun 08 '11 at 08:23
  • 1
    So far it has not worked for me, it says 'require': no such file to load -- RMagick2.so. This crashes the Mongrel Server – Travis Pessetto Jul 20 '11 at 22:16
  • 1
    @TravisPessetto I had the same problem, but I found the solution for problem. The [rmagick-FAQ](http://rmagick.rubyforge.org/install-faq.html#loaderror) recommend to set `LD_LIBRARY_PATH` not `LIBRARY_PATH` like in this description. With `LD_LIBRARY_PATH` it worked fine for me. – knut Oct 13 '11 at 21:19
  • I am still stuck, but I'm just going to chip in to say "WTF??? Software that can't be installed in a directory path containing spaces??? Is it 1993????" – glenatron Aug 19 '12 at 22:27
  • Plain `gem install rmagick` doesn't work for me. It has to be `gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick-6.7.9-Q16/lib --with-opt-include=c:/ImageMagick-6.7.9-Q16/include` like Luis Lavena said in [his answer](http://stackoverflow.com/a/6477787/196451) – Endy Tjahjono Sep 13 '12 at 10:22
  • 5
    RMagick no longer works with ImageMagick 6.8. See the GitHub wiki for detailed instructions https://github.com/rmagick/rmagick/wiki – Chloe Jan 30 '13 at 01:30
  • looks like all the links to the Windows binaries on the ImageMagick site are dead (404). – stian Mar 08 '13 at 09:57
  • Correct me if I'm wrong, but you don't have to install DevKit if RailsInstaller or RubyInstaller has already done it for you. – Clucking Turtle May 26 '13 at 02:03
  • 6 steps for me: I had to set `imagemagick_convert_command` explicitly in the configuration.yml. – marapet Jan 17 '14 at 14:55
  • Worked for me on Win764 & ImageMagick 6.8.7.0 – Richard Peck Apr 30 '14 at 17:14
10

After some attempts, this finally worked for me:

  1. Install DevKit : https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

  2. Install ImageMagick (tick yes for headers in the installer) to a folder without spaces in its path (i used C:/ImageMagick)

  3. Open up mingw (msys.bat in DevKit folder) -- and run gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick/lib --with-opt-include=c:/ImageMagick/include (replace the two paths to account for your imagemagick path if needed)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Jostein
  • 3,124
  • 1
  • 22
  • 27
  • Thanks for this version. It succeeded also for me - and there is no need to adapt (LD)LIBRARY_PATH. – knut Oct 02 '12 at 20:15
  • God bless you! I spent hours looking for the solution. I was missing step 3, more exactly I was running `gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick/lib --with-opt-include=c:/ImageMagick/include` in cmd instead of msys.bat in DevKit folder – Adrian Moisa Sep 15 '16 at 14:07
5

I believe there are a few gotchas with RMagick and 1.9, as discussed in this thread at RubyInstaller group.

However, here you can find a post describing the steps.

Other tutorials can be found in our wiki

Hope that helps

Luis Lavena
  • 10,348
  • 1
  • 37
  • 39
  • 1
    The post describing the steps was what I needed, especially the `gem install rmagick --platform=ruby -- --with-opt-lib=c:/ImageMagick-Path/lib --with-opt-include=c:/ImageMagick-Path/include` part- that was the missing step from my attempts to install it. – glenatron Aug 19 '12 at 22:35
4

Srividya's solution also works with ImageMagick-6.7.0-8-Q16-windows-dll and RMagick 2.13.1.
Make sure you are using 32-bit version of ImageMagick if this doesn't work for you on 64-bit version of Windows.
I did, and it works.

Yu-raku-an
  • 41
  • 2
1

This did the trick for me using ruby 2.0:

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

make sure to specify your own version of ImageMagick and the file path you installed it in & include the lib folder on the command

coderwannabe2
  • 221
  • 1
  • 2
  • 12
0
  • Installed rmagick in c:\rmagick.. folder

And tried the following command and it works:

gem install rmagick --platform=ruby -- --with-opt-lib=C:\ImageMagick-6.8.6-Q16\lib --with-opt-include=c:\ImageMagick-6.8.6-Q16\include
Anatoliy Nikolaev
  • 22,370
  • 15
  • 69
  • 68
chank
  • 3,546
  • 1
  • 14
  • 22