RMagick Installing RMagick on Linux, *BSD, or Cygwin systems

This page describes a method for installing RMagick, ImageMagick or GraphicsMagick, and the delegate libraries used by ImageMagick and GraphicsMagick. You only need to install one of ImageMagick or GraphicsMagick. The procedure is the same for either library. Throughout the remainder of this document I will use the word ×Magick to refer to either of these two libraries. I developed this procedure using Mandrake Linux. If you are using FreeBSD or a different Linux distro some of the details may be different. In particular these instructions assume you are using bash as your shell.

You will need to have a connection to the Internet and around an hour of free time (assuming you have a broadband connection).

Step 0: Install the GNU development tools

Depending on how you originally set up your system you may already have these tools. If not, you'll need to install

Generally each system has these tools available as pre-built packages. Consult your system documentation for more information.

Step 1: Install the delegate libraries

I recommend these delegate libraries:

You may also want to install some of the other delegate libraries listed in the FAQ. Your distribution may include at least some of these libraries by default and probably provides pre-built packages for the others. If not, the delegates are available as source code tarballs from http://www.imagemagick.org/pub/delegates/.

Step 2: Install ImageMagick or GraphicsMagick

Go to http://www.imagemagick.org or http://www.graphicsmagick.org (if you install GraphicsMagick you must install RMagick 1.15.nn) and download the latest version of the software to a temporary directory. Unroll the tarball and make the top directory current. For example, if you downloaded the ImageMagick.tar.gz file, use these commands (where X.Y.Z is the ImageMagick version number):

  tar xvzf ImageMagick.tar.gz
  cd ImageMagick-X.Y.Z

Similarly, if you downloaded the GraphicsMagick-LATEST.tar.gz file, use these commands (where X.Y.Z is the GraphicsMagick version number):

  tar xvzf GraphicsMagick-LATEST.tar.gz
  cd GraphicsMagick-X.Y.Z

The same command can be used to configure either ImageMagick or GraphicsMagick:

./configure --disable-static --with-modules --without-perl \
     --without-magick-plus-plus --with-quantum-depth=8

The ./configure command should be entered on a single line. This installs ×Magick in /usr/local. If you want to install into another directory use the --prefix option.

The configure command should be entered on a single line. Here's what the options do:

Finally, if you have the standard Microsoft Windows fonts on your system (as is frequently the case when dual-booting), add the --with-windows-font-dir option to tell ×Magick where to find them. For example, suppose you have the Windows fonts in the /mnt/windows/windows/fonts directory:


For more information about all these options see ImageMagick/GraphicsMagick's README.txt file.

There are many more options. For more information about all these options see ×Magick's README.txt file.

./configure will produce quite a bit of output. The last page is the most interesting. If you've successfully performed all the steps so far and used all the defaults, the output from configure should end with a page similar to this. (Of course some of the details will be different depending on your system.)

ImageMagick is configured as follows. Please verify that this configuration
matches your expectations.

Host system type : i686-pc-linux-gnu

                  Option                        Value
Shared libraries  --enable-shared=yes           yes
Static libraries  --enable-static=no            no
Module support    --with-modules=yes            yes
GNU ld            --with-gnu-ld=yes             yes
Quantum depth     --with-quantum-depth=8        8

Delegate Configuration:
BZLIB             --with-bzlib=no               no
DPS               --with-dps=yes                yes
FlashPIX          --with-fpx=no                 no
FreeType 2.0      --with-ttf=yes                yes
GhostPCL          None                          pcl6 (unknown)
Ghostscript       None                          gs (7.07.2)
Ghostscript fonts --with-gs-font-dir=default    /usr/share/fonts/default/Type1/
Ghostscript lib   --with-gslib=no               no
Graphviz          --with-gvc=no                 no
JBIG              --with-jbig=yes               no
JPEG v1           --with-jpeg=yes               yes
JPEG-2000         --with-jp2=no                 no
LCMS              --with-lcms=no                no
Magick++          --with-magick-plus-plus=no    no
PERL              --with-perl=no                no
PNG               --with-png=yes                yes
TIFF              --with-tiff=yes               no
Windows fonts     --with-windows-font-dir=/mnt/windows/windows/fonts    /mnt/windows/windows/fonts/
WMF               --with-wmf=yes                yes
X11               --with-x=                     yes
XML               --with-xml=yes                yes
ZLIB              --with-zlib=yes               yes

X11 Configuration:
  X_CFLAGS     = -I/usr/X11R6/include
  X_PRE_LIBS   = -lSM -lICE
  X_LIBS       = -L/usr/X11R6/lib

Options used to compile and link:
  PREFIX      = /usr/local/ImageMagick-X.Y.Z
  EXEC-PREFIX = /usr/local/ImageMagick-X.Y.Z
  VERSION     = X.Y.Z
  CC          = gcc
  CFLAGS      = -g -Wall -pthread
  CPPFLAGS    = -I/usr/local/ImageMagick-X.Y.Z/include
  PCFLAGS     =
  LDFLAGS     = -L/usr/local/ImageMagick-X.Y.Z/lib -L/usr/X11R6/lib -lfreetype -lz -L/usr/lib
  LIBS        = -lMagick -ltiff -lfreetype -ljpeg -lXext -lSM -lICE -lX11 -lXt -lz -lpthread -lm -lpthread
  CXX         = g++
  CXXFLAGS    = -pthread

Of course, instead of VERSION X.Y.Z you will see the version number of the version of ×Magick that you downloaded. Check your output to make sure that ×Magick located all the delegate libraries. You should see "yes" in the Value column for FreeType 2.0, JPEG v1, PNG, WMF, X11, as well as for any other delegate libraries you chose to install.

If you get this output from ./configure you're ready to proceed. If you are missing some delegates you should resolve those issues before continuing. Re-run ./configure, being very careful to enter the commands correctly.

Once you're satisfied that you've configured ×Magick the way you want it, enter these two commands:

sudo make install

Where to go for more information

Check this page for in-depth information about installing ImageMagick. Check this page for more information about installing GraphicsMagick.

Step 3: Install RMagick

The hard part is done. All we have to do now is install RMagick. Here you have two choices.

  1. Install the rmagick gem.
  2. Install RMagick from the source tarball.

Installing the gem takes only one command, but you must first install RubyGems and if something goes wrong it's harder to figure it out. Installing from the source tarball produces better diagnostic output, which is useful if you run into trouble.

Option A. Install the rmagick gem

Issue the command

sudo gem install rmagick

If you installed GraphicsMagick in step 2 then you must install the latest RMagick 1.15.nn gem using the gem command's -v option, like this. Use the latest fix number instead of nn.

sudo gem install rmagick -v 1.15.nn

You'll see this output:

Bulk updating Gem source index for: http://gems.rubyforge.org
Building native extensions.  This could take a while...
Successfully installed rmagick-X.Y.Z

Be patient. A lot of time will pass with no output from the gem command. The "Successfully installed" message does not mean that RMagick was successfully installed. The RMagick installation can encounter error conditions that gem can't detect. The following irb session is a better indicator of a successful install. (Of course the version numbers in the message may vary from what is shown here, depending on what versions of the software are currently available.)

$ irb -rubygems -r RMagick
irb(main):001:0> puts Magick::Long_version
This is RMagick 1.15.3 ($Date: 2007/01/20 15:45:29 $) Copyright (C) 2007 by Timothy P. Hunter
Built with ImageMagick 6.3.2 02/23/07 Q8 http://www.imagemagick.org
Built for ruby 1.8.5 (2006-12-25 patchlevel 12) [powerpc-darwin8.0.0]
Web page: http://rmagick.rubyforge.org
Email: rmagick@rubyforge.org
=> nil

The RMagick HTML documentation is automatically installed at /usr/local/share/RMagick/index.html.

Option B. Install RMagick from the source tarball

If you haven't already done so, download the RMagick tarball from RubyForge (if you installed GraphicsMagick in step 2 then you must download RMagick 1.15.nn) and unroll it into a temporary directory. Make that directory current.

  tar xvzf RMagick-X.Y.Z.tar.gz
  cd RMagick-X.Y.Z



There is no need to use --prefix. RMagick will be installed in the appropriate directory in Ruby's search path.

The configure script accepts some RMagick-specific options for special conditions. Enter ./configure --help for more information.


The make step will take a few minutes to run since it builds all of the RMagick examples. You should get no error messages. If something is wrong with the way ImageMagick/GraphicsMagick was configured and more than 5 examples fail, you'll get an error message here. Fix the problem(s) and re-install ImageMagick/GraphicsMagick.

sudo make install

The RMagick HTML documentation is automatically installed at /usr/local/share/RMagick/index.html.

That's it. You should have a complete install of ImageMagick/GraphicsMagick and RMagick.

Back to the FAQ.