Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails RMagick on Windows 7

Alright, I've been trying to install Rmagick on a Windows 7 x64 machine pretty much all day. I've checked out every single tutorial on Stack Overflow and other sites, but I keep getting an "Invalid Drive Specification" error no matter which tutorial I follow. My environment came from http://railsinstaller.org/. Has anyone successfully installed Rmagick recently that can point me in the right direction? Thanks, this is driving me crazy but I really have to get it working.

like image 269
jwBurnside Avatar asked Jun 24 '11 21:06

jwBurnside


2 Answers

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.

like image 70
Luis Lavena Avatar answered Oct 09 '22 12:10

Luis Lavena


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
like image 33
Francois Avatar answered Oct 09 '22 13:10

Francois