Tuesday, June 24, 2008

Installing RMagick Ruby gem

Just for a record (because I forgot how when I had to do it again on another server):

* On Ubuntu Hardy:

1. Install ImageMagick.

$ sudo aptitude install libmagick9-dev

$ sudo aptitude install imagemagick

2. Install RMagick gem.

$ sudo gem install rmagick

* On Mac OS X Leopard (with MacPort):

1. Install ImageMagick.

$ sudo port install ImageMagick

2. Install RMagick gem.

$ sudo gem install rmagick


Tadatoshi said...

Since I had a problem installing libmagick9-dev on another Ubuntu Hardy on Feb 3, 2009, I have tried ImageScience. (Actually, the only thing I wanted was to use attachment_fu to upload PDF files, etc. I was not uploading image. But attachment_fu requires to have some image processor.)

* On Ubuntu Hardy:

1. Install FreeImage.

$ sudo aptitude install libfreeimage3

2. Install ImageScience gem.

$ sudo gem install image_science

Tadatoshi said...

I have decided to install ImageMagick from source on Ubuntu Hardy (Ubuntu 8.04.1). (By the way, installing it from aptitude works on Ubuntu 8.04.2, also Ubuntu Hardy.)

1. Download ImageMagick from http://www.imagemagick.org/script/download.php. I downloaded ImageMagick-6.5.5-4.tar.bz2 (latest as of August 29, 2009).

2. Untar it:

$ tar xvfjp ImageMagick-6.5.5-4.tar.bz2

3. Go to the extracted directory:

$ cd ImageMagick-6.5.5-4

4. Configure:

$ ./configure --prefix=/usr/local

5. make:

$ make

6. Install libperl-dev that is required by "make install". Otherwise, an error occurs ("/usr/bin/ld: cannot find -lperl"). I used apt-get following http://ubuntuforums.org/showthread.php?t=204908. But now I regret that I didn't use aptitude.

$ sudo apt-get install libperl-dev

7. make install:

$ sudo make install

8. Now installing RMagick gem succeeds:

$ sudo gem install rmagick

9. Then I uninstalled ImageScience gem because it was showing errors when "script/console" is used in Ruby on Rails:

$ sudo gem uninstall image_science