Ruby on Rails Rmagick on Windows 7

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.

Install ImageMagick and rmagick on Windows 7

I have installed it. You will need to install Ruby Devkit.

https://rubyinstaller.org/downloads/

It was very tedious process so I made notes for a client. Steps are mislabelled because it includes installing git and ruby first. I would use more recent instructions on websites if available.

I think that ImageMagick needed to be version 6, not sure.

Here are the notes:

3. Install devkit

Same link http://rubyinstaller.org/

Download and extract to C:\RubyDevkit

Follow steps 3.1 and 3.2 if you downloaded DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe

For other versions, if you are getting error messages then use instructions from http://rubyinstaller.org/

which used to link to this document:
https://github.com/oneclick/rubyinstaller/wiki/Development-Kit

3.1. Entire DevKit procedure at a glance

  • Download matching version (from http://rubyinstaller.org/)
  • Uninstall previous version if it exists.
  • Extract to C:\RubyDevKit

You need to open CMD.exe (do not use git bash) to C:\RubyDevKit and type these commands.

cd C:\RubyDevKit
ruby dk.rb init
ruby dk.rb install
devkitvars.bat

4. Install imagemagick

If your ruby is 32 bit, install 32 bit otherwise 64 bit.

What works for sure is ImageMagick-6.7.3-4-Q16-windows-dll.exe

Don't install in Program Files because 3rd party scripts might have problems with spaces.

Install in C:\ImageMagick so that you can copy paste commands later

Make sure these options are checked

  • Add application directory to your system path
  • Install development headers and libraries for C and C++

5. Install rmagick gem

Just running bundle install fails because it requires more options.

Run this from anywhere in cmd.exe

To open cmd.exe open Start Menu and under Search programs and files type cmd.exe

set CPATH="C:\ImageMagick\include"
set LIBRARY_PATH="C:\ImageMagick\lib"

Unfortunately these commands give no visual feedback like OK. To get feedback you can type this:

echo %CPATH%

And you should get output "C:\ImageMagick\include"

echo %LIBRARY_PATH%

And you should get output "C:\ImageMagick\lib"

gem install rmagick -- '--with-opt-dir="C:\ImageMagick"'

You should get a success message. You can verify if gem is installed by typing

gem list

It should list rmagick.

Try this first, but in case this doesn't work, look up more current instructions on:

https://github.com/rmagick/rmagick/wiki/Installing-on-Windows

how do you get rmagick to work on windows 7 64-bit with rails 3.1 and carrierwave?

Answer in this thread made it work on both of my computer: RMagick on Windows

I hope it'll work for you too !

How to install rmagick gem on Windows?

RMagic won't work with ImageMagic 6.8. I updated the RMagick Github wiki with detailed instructions.

https://github.com/rmagick/rmagick/wiki

There I found gems (haha) such as

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.

and

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

(Obvious, huh?)

I believe RMagick is a dead project. There hasn't been a commit for 2 years!

installing rmagick gem on windows

I had this problem a few days ago and I solved it by following a bunch of tutorials.

In short, your error seems to be due to a compatibility problem between your ImageMagic and Rmagick.

Uninstall ImageMagick and re-install a previous version that works with your Ruby setup.

This is what worked for me :

  • Ruby 1.9.3
  • Dev Kit 32-4.5.2
  • ImageMagick 6.7.7 (I had a really hard time finding binary versions for legacy versions of ImageMagick so i guess this link will be handy for you)
  • Rmagick 2.13.2

Can't install gem rmagick [Windows 7 64 bit]

CarrierWave is indeed a great solution for managing image uploads in Rails.
RMagick is very powerful, but you won't believe how much trouble me and my friends had through the years while installing and upgrading RMagick and ImageMagick in various environments and operating systems (especially Windows and Mac).

If you have ImageMagick installed, and you don't worry too much about performance, you can use MiniMagick instead of RMagick. It's much easier to install it. In your uploader class you can include MiniMagick:

class MyUploader < CarrierWave::Uploader::Base  
include CarrierWave::MiniMagick

...
end

This complexity of image processing tools is one of the reason I would suggest you take a look at our solution for integrating CarrierWave while all image transformations are done in the cloud (no need to install RMagick or ImageMagick at all). This blog post describes the solution. Just switch the CarrierWave plugin you include:

class MyUploader < CarrierWave::Uploader::Base  
include Cloudinary::CarrierWave

...
end


Related Topics



Leave a reply



Submit