Ruby: Installing rmagick on Ubuntu
Install the packages imagemagick
and libmagickwand-dev
(or libmagick9-dev
). You should then be able to install the Rmagick Gem.
sudo apt-get install imagemagick libmagickwand-dev
If not, you are missing ruby related development packages like build-essential
and ruby1.8-dev
. If that's the case, a generic "ubuntu install ruby 1.8" query in google should sort you out.
Installing RMagick Gem
use rvm to install ruby (preferred) or use apt-get install ruby ruby-dev
aptitude install build-essential imagemagick libmagickcore-dev libmagickwand-dev
gem install rmagick
--Edit 1--
sudo apt-get install ruby-dev
You will also need ruby-dev (or ruby-full) for successfully compiling the RMagick before gem install.
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!
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
- 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
Related Topics
Standalone Ruby -- How to Load Different Environments from Database.Yml
Robustly Call a Flaky API: Proper Error Handling with Net::Http
Ruby on Rails HTML-Table Generator
How to Find .Index of a Multidimensional Array
Rails Render Partial in Helper
Error Connecting to Redis on 127.0.0.1:6379 (Errno::Econnrefused) - Wercker
Carrierwave Cannot Remove Image
How to "Nest" the Inclusion of Modules When Using the Ruby on Rails Activesupport::Concern Feature
Carrierwave: Create 1 Uploader for Multiple Types of Files
Installing Pl/Ruby for Postgresql 8.3
How to Use Ruby to Write Individual Records to a Redshift Database
Rails 3.1 Rspec Creating Test Case Validate Field for Model
Why Is Foreman Gem Ignoring the Port Environment Variable