Skip to content

Jan 4 / Rupak Ganguly

How to install RMagick + ImageMagick on Windows

I have installed RMagick and Image Magick on many Windows machines and I have stumbled across various kinds of errors, and finally I have decided to document them so that I could not only document it for myself, but for other people like me, who are stuck due to these errors.

Update: I have also included instructions for installing RMagick on Ubuntu and MacOSx as well.

Installation on Windows

The issues that I have faced are as follows:

A. This version of RMagick was created to run with ImageMagick 6.3.0 but ImageMagick 6.3.5 is installed on this system. You should either
1) Configure and build RMagick for ImageMagick 6.3.5, or
2) download ImageMagick 6.3.0 from http://www.imagemagick.org and install it.
B. Errors about missing CORE_.. .dll file(s).
C. Errors about missing sqlite3.dll.

Issue A. stems from the fact that you have a incompatible version of ImageMagick installed which does not work with RMagick. The solution would be to uninstall any existing ImageMagick and/or RMagick gem, and start all over as described below.

Issue B. tells me that either ImageMagick or RMagick is not installed properly.

Issue C. is a bit off and has nothing to do with ImageMagick or RMagick. It is probably being thrown by the plugin or application that you are using that needs ImageMagick or RMagick. To fix this issue, just install Sqlite3 and I have a post just for that.

Now that we have tackled the issues, let’s get to the goal – how to install RMagick + ImageMagick on Windows.

  1. Uninstall any Image Magick or RMagick gem from before.
  2. Download rmagick-win32 for windows that has the gem and the ImageMagick installer from http://rubyforge.org/frs/download.php/64917/RMagick-2.12.0-ImageMagick-6.5.6-8-Q8.zip
  3. Unzip the rmagick-win32 zip file that you downloaded above.
  4. Install the ImageMagick from the installer that came in the zip i.e. run the ImageMagick-6.5.6-8-Q8-windows-dll.exe. This will install ImageMagick for you.
  5. Now, we need to install the rmagic gem that came in the zip i.e. rmagick-2.12.0-x86-mswin32.gem. To do that, run the following command on a windows command line:
    > gem install <path where you downloaded and then unzipped the rmagick zip>\rmagick-2.12.0-x86-mswin32.gem

    Note: When you read this post, the version nos. of the gem and the zip file may change. Please adjust your commands for that.

  6. If you get Issue C., from above you probably are left with installing Sqlite3. If you need help you can look up my post.

That should get you going on Windows machines. Yet another big Ruby on Rails development hurdle on Windows, solved for good.

Installation instructions for Ubuntu

1. Undo any old leftover install baggage

sudo apt-get remove --purge librmagick-ruby-doc librmagick-ruby1.8

2. Install the appropriate version

sudo apt-get install libmagick9-dev ruby1.8-dev

3. Install the rmagick gem

gem install rmagick

That should get you going on Ubuntu machines.

Installation instructions for MacOSx

If you want to use Homebrew, then do the following:

1. Install ImageMagick via a homebrew

brew install imagemagick

3. Install the rmagick gem

gem install rmagick

If you want to use macports, you can see the instructions at the RMagick site.

That should get you going on MacOSx machines.

If you have any other issues or questions regarding the subject, please let me know via comments. I will try my best to help you.

20 Comments

leave a comment
  1. Ger / Feb 26 2010

    Great, concise tutorial! Thx

    • elad / Apr 29 2014

      nice and easy!

  2. Rupak Ganguly / Feb 26 2010

    Hi Ger,
    It is a pleasure to see that my notes helped you. I try to cover the quirky problems that we face especially for people on Windows.

  3. Sardor / Mar 13 2010

    Thx…

  4. Brian Dunning / Mar 30 2010

    I installed as described above. Everything seems to be fine so far. No errors reported.

    Then when I try to start WEBrick I get the following error. I’ve been scanning Google searches for anything that comes close, but yours is the first site with anything vaguely connected.

    I had Ruby 1.9 but got incompatibility problems once I tried to get Image Magick going. I therefore installed 1.8.6 as recommended.

    I’m running (trying to run) on Vista. ANY help would be appreciated.

    => Booting WEBrick
    => Rails 2.3.5 application starting on http://0.0.0.0:3000
    F:/ruby186/lib/ruby/gems/1.8/gems/rmagick-2.12.0-x86-mswin32/ext/RMagick2.so: 14001: The application has failed to start because its side-by-side conf
    tion is incorrect. Please see the application event log for more detail. – F:/ruby186/lib/ruby/gems/1.8/gems/rmagick-2.12.0-x86-mswin32/ext/RMagick2
    LoadError)
    from F:/ruby186/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require’
    from F:/ruby186/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require’
    from F:/ruby186/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in’
    from F:/ruby186/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require’
    from F:/ruby186/lib/ruby/gems/1.8/gems/rmagick-2.12.0-x86-mswin32/lib/RMagick.rb:11
    from F:/ruby186/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require’
    from F:/ruby186/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require’
    from F:/ruby186/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require’
    … 8 levels…
    from F:/ruby186/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:84
    from F:/ruby186/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
    from F:/ruby186/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’
    from script/server:3

  5. rajeshrs / Apr 3 2010

    Superbly working…great. Thanks.

  6. Bindu / May 3 2010

    Thanx…I struck in my project with Rmagick and it really helped me.

  7. Amy / Jun 5 2010

    Thx…

  8. Ben / Aug 16 2010

    Just a note to say this won’t work on Ruby 1.9. I get a segmentation fault when ‘requiring’ RMagick in IRB.

  9. Rupak Ganguly / Jan 25 2011

    Carlo,
    Thanks for the comment with your post link.

  10. Carlo Bertini / Feb 5 2011

    @rupak
    nothing :D

  11. @_jpgo / Mar 28 2011

    TANKS sincerely you help saves me.

    ImageMagick 6.6.8-10 have the same bugs… ooops!!!

    • Periyasamy / Aug 8 2012

      Thanks Its working. Great

  12. s26 / Nov 19 2012

    Awesome explanation. It worked. Thanks.

  13. Ewa / Nov 22 2012

    Thank you.. that helped a lot!

  14. Helen / Jun 12 2013

    Finally got it working on Windows! Thank you a million times over.

  15. Rodrigo / Jan 25 2014

    Obrigado!

    Thanks!

  16. Raafat / Nov 25 2014

    I’m trying to install rmagick for ruby on rails on windows but I’m always getting errors. I’ve followed several tutorials but non of them worked. This is the error I’m getting:

    C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/mkmf.rb:431:in `try_do’: The compiler
    failed to generate an executable file. (RuntimeError)
    You have to install development tools first.
    from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/mkmf.rb:562:in `try_cpp’

    from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/mkmf.rb:1041:in `block i
    n have_header’
    from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/mkmf.rb:892:in `block in
    checking_for’
    from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/mkmf.rb:337:in `block (2
    levels) in postpone’
    from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/mkmf.rb:307:in `open’
    from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/mkmf.rb:337:in `block in
    postpone’
    from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/mkmf.rb:307:in `open’
    from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/mkmf.rb:333:in `postpone

    from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/mkmf.rb:891:in `checking
    _for’
    from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/mkmf.rb:1040:in `have_he
    ader’
    from extconf.rb:186:in `’

    Gem files will remain installed in C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0
    .0/gems/rmagick-2.13.3 for inspection.
    Results logged to C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rmagick-2
    .13.3/ext/RMagick/gem_make.out

    Please help I’m desperate :/

Trackbacks and Pingbacks

  1. RMagick installation « My Blog
Leave a Comment