Ruby on Rails RMagick on Windows 7

前端 未结 5 685
悲&欢浪女
悲&欢浪女 2020-12-06 03:12

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

相关标签:
5条回答
  • 2020-12-06 03:26

    I don't have enought privileges, sorry for posting my comment to Luis Lavena's answer here.

    One solution that worked for me was running Luis Lavena's solution from "Command Prompt with Ruby and Rails" (from the Windows start menu). It loads all necessary configurations.

    0 讨论(0)
  • 2020-12-06 03:33

    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++
    3. 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

    0 讨论(0)
  • 2020-12-06 03:34

    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.

    0 讨论(0)
  • 2020-12-06 03:37

    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
    
    0 讨论(0)
  • 2020-12-06 03:37

    I did install it about a month ago. One of many errors I had to overcome was the "Invalid drive specification"

    I've just started a blog with a post about installing RMagick on Win7 based on my self-answered question here. One note though: I used ruby 1.9.2 and railsinstaller seem to use 1.8.7.

    If I remember it right, this error could be caused by spaces in your image magick installation path.

    0 讨论(0)
提交回复
热议问题