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.
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.
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
We just had this problem with Windows 7, Ruby 2.0 & Rails 4.0
This tutorial works really well:
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))
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++
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
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.
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.
Related
I had a program that worked a few weeks ago and I wiped it out and had to re-install my ruby and rails enviornment and now I can not bundle install the same program because Paperclip requires Mimemagic and apparently the working versions of the gems no longer exist. Any versions of the gem that remain require this freedesktop.org.xml thing which I went to their site and downloaded but I do not understand on a windows machine how to install the freedesktop.org.xml package so that I can use Ruby on Rails again.
Does anyone know how to install the freedesktop.org.xml package/script/whatever it is so that rails will work properly again? If ANY of our apps break now we are going to be a HORRIBLE place due to this. I have been searching for hours and everything references a MAC or Linux, I am on a PC and I can find NOPLACE that has understandable instructions for how to do this on a Windows 10 PC.
Please HELP!
Thank You,
Scott
Update: I tried the suggestion to add:
gem 'mimemagic', git: 'git#github.com:mimemagicrb/mimemagic.git', tag: "v#{[0.3.0]}"
into the gemfile and this is the results I get.
[!] There was an error parsing `Gemfile`: unexpected fraction part after numeric literal - . Bundler cannot continue.
# from D:/rails/ctrlpanel/Gemfile:22
# -------------------------------------------
# # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
> gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
# source 'https://rubygems.org'
# -------------------------------------------
I don't understand what this means? I also don't understand this entire issue? Is there no way that the freedesktop.org.xml thing can be installed on a Windows PC? This seems like this officially kills Ruby on Rails on a Windows PC?
The old versions of mimemagic were, annoyingly, hard-deleted from rubygems.org because the author became aware that the library was incorrectly licensed as MIT rather than GPLv2.
More recent versions (v0.3.7+) of the library are correctly licensed as MIT.
I tried the suggestion to add:
gem 'mimemagic', git: 'git#github.com:mimemagicrb/mimemagic.git', tag: "v#{[0.3.0]}"
That won't work on two accounts: Firstly you misunderstood the proposition - just writing tag: 'v0.3.0' was all that's needed, but additionally, it appears the mimemagic author has also tried to cover their backs (legally) by untagging the old library versions in github!!!
...But mimemagic still has full source control! So if you want to explicitly install an old version, it's still pretty easy to pin it directly to a git commit!!
For example, look here at the project history.
If you want to install version 0.3.5 of the gem, you can add this to your Gemfile:
gem 'mimemagic', git: 'https://github.com/mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'
It should be pretty easy to find the reference commit for other versions, using the above link to the project's history.
However as noted above, old versions of this project were incorrectly licensed as MIT. If you are unable to include a GPLv2 licensed library in your project (I am not a lawyer, and this is not legal advice...), you should not be using this approach.
For more information on how to specify git branches/tags/commits in a Gemfile, see the documentation: https://bundler.io/guides/git.html
This issue can be solved by setting FREEDESKTOP_MIME_TYPES_PATH to point to freedesktop.org.xml before installing the gem or running Bundler.
Example:
Step 1:
Right click and save this file as freedesktop.org.xml to C:\.
Step 2:
Set FREEDESKTOP_MIME_TYPES_PATH in the current command prompt (not permanently stored):
> set FREEDESKTOP_MIME_TYPES_PATH=C:\freedesktop.org.xml
Step 3:
Install the gem (or run bundle install) from the same prompt as in step 2:
> gem install mimemagic
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
Successfully installed mimemagic-0.4.3
1 gem installed
I have a new Mac computer and installed rails on it, and then I tried out the command
gem outdated
for some reason, it showed one of the gems outdated:
webrick (1.4.2 < 1.6.0)
I wonder why it is outdated on the first installed, and when I did
sudo gem install webrick
it actually installed 1.6.0 onto the system. Doesn't it require gem update instead of install to update something? How come install also updated it?
Not exactly, gem install GEM_NAME will install the last version available if you don't specify a version when installing, and you can have more than 1 version of the same gem on your machine.
you can run gem environment, and check where gems are installed, go to that folder and you will see both version gems folder there.
so when you create a rails project for example and add a specific version of a gem in the gemfile and another version on another project, you can have both without problems
I currently have Ruby 2.2.6 and Rails 5.0.1 installed on my Windows 10 machine. I have cloned an existing project that has the following settings included in its Gemfile:
# Lock-in Lang and Framework:
ruby '2.2.0'
gem 'rails', '4.2.0'
I'm having a surprisingly hard time figuring out how to get Ruby 2.2.0 and Rails 4.2.0 installed. Ruby has good documentation of different installation options, but I think I've exhausted the Windows options without any success. Here are a couple I tried:
Installers: I couldn't find an option for downloading either from RailsInstaller, RubyInstaller, and Bitnami.
RVM: I tried (unsuccessfully) following this blog post to install cygwin so that I could use RVM, but then saw in the comments that the author now recommends spinning up a linux VM rather that using this method.
Pik and Uru: It appears Pik is no longer maintained, and I couldn't figure how to download new versions and ruby and rails with Uru as opposed to managing already downloaded versions.
EDIT: I also tried simply changing the version numbers for ruby and rails in the Gemfile to 2.2.6 and 5.0.1. When I do this I (very understandably) get a message when I try to use a rails command saying I need to run bundle update rails. When I run that rails update I get the following error: Bundler could not find compatible versions for gem "rack". I've done some googling on that option, and it looks like resolving that issue might be possible but requires some more involved tinkering with my Gemfile configuration.
I think my next option is to install Ruby from the source, but I wanted to throw a question up here first to make sure I'm not missing an easier method. So my question is - is it really this hard to get an older minor release of ruby and rails installed on Windows? I realize that the majority of users are probably looking for the most recent release, but it doesn't seem to me that my use case is terribly unique.
The oldest available Ruby 2.2.x via RubyInstaller is 2.2.1
So, the answer to your question is, "Yes, you'll have to build from source."
But then again,
v2.x of gem "rack" requires at least Ruby v2.2.2
And depending on what other gems are included in your Gemfile, you'll still have to reconfigure your Gemfile to get this app running.
So the best solution is probably to use the latest patch version of Ruby 2.2.x and lock rails to 4.2.x. (The app may not be compatible with Rails 5.x)
# Lock-in Lang and Framework:
ruby '2.2.6'
gem 'rails', '~> 4.2'
Then run bundle install to install all the gems required by the Gemfile
Hello everyone I am new to rails I am following lynda tutorial and I am trying to install mysql2 but the error is showing I have look on various page of stack overflow but was not able to resolve it.My Error is
ERROR: Could not find a valid gem 'mysql2' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - no such name (https://api.rubygems.org/latest_specs.4.8.gz)
On Windows, you need to use the following:
Download C-Connector & unzip to a non-spaced path on your system
Install the gem referencing the new path:
gem install mysql2 --platform=ruby -- --with-mysql-dir="C:/path/to/your/c-connector/install/no/spaces"
This should install the gem, allowing you to proceed with your other installation.
--
The reason this has to be done on Windows is due to the fact that the mysql2 gem requires an external set of dependencies (the c-connector plugin), which Windows does not have installed by default.
Linux users can use apt-get, and Mac users brew to get the dependencies; Windows users have to download it themselves.
If you follow the steps above, you should get the mysql2 gem installed.
I think there is some typos in your gemfile, Check if you have type correct version mentioned in the tutorial. mysql gem should look like below.
gem 'mysql2', '~> 0.3.11'
I'm deploying a railsapp to ubuntu
rmagick is installed via "bundle install vendor". it installs , and the app runs -- but this error gets thrown :
uninitialized constant Image::Magick
when trying to read:
source_image = Magick::Image.read("#{Rails.root}/public/system/assets/#{self.id}/original/#{self.asset_file_name}").first
I've done the following:
uninstsalled, then reinstalled, ImageMagick on the server
uninstalled, then reinstalled, rmagick on the server
uninstalled, then reinstalled, rmagick via bundler
run with only the bundler rmagick installed
run with the bundler and system rmagick installed
proxied nginx to rails-server to ensure the error is not related to passenger
I'm going a bit crazy trying to figure out what else I can do to make rmagick see imagemagick
After hours of fighting and recompiling imagemagick and rmagick under different combinations, I lucked out on a 1 line fix
Gemfile
- gem 'rmagick'
+ gem 'rmagick', :require => 'RMagick'
Bundler requires the gem name by default,
i.e. :require => 'rmagick'.
But the file being included is actually 'RMagick.rb'. For case-insensitive file systems, like OS X, this will work, but for case-sensitive file systems, like Ubuntu, the file will not be found.
This can be one of the reasons why the error can't be produced on the dev system, even when running in production mode.
Doing a gem install rmagick as a privileged user fixed the issue for me.
Not really a helpful solution, but I guess in my case I didn't actually have RMagick installed properly, even though bundler thought I did.