|Installing RMagick 2 on Linux, *BSD, or Cygwin systems|
This page describes a method for installing RMagick, ImageMagick, and the delegate libraries used by ImageMagick. I developed this procedure using Ubuntu. 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).
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.
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/download/delegates/.
Determine where the Ghostscript fonts are installed on your system. The installation directory differs from distribution to distribution. On Ubuntu, for example, the directory is usually /usr/share/fonts/type1/gsfonts. On Fedora, /usr/share/X11/fonts/Type1. We'll call this directory $FONTS.
Go to http://www.imagemagick.org 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
Enter this command:
./configure --disable-static --with-modules --without-perl \ --without-magick-plus-plus --with-quantum-depth=8 \ --with-gs-font-dir=$FONTS
./configure command should be entered on a
single line. This installs ImageMagick in /usr/local. If you want
to install into another directory use the --prefix option.
configure command should be entered on a
single line. Here's what the options do:
--with-modulescause ImageMagick/GraphicsMagick to be built with dynamically loaded modules.
--without-magick-plus-plusto suppress installing Perl and C++ support.
--with-quantum-depth=8configures ImageMagick to use a bit depth of 8. The default quantum depth for ImageMagick is 16. See Speed up your RMagick apps in 1 easy step in the RMagick Hints & Tips Forum for a discussion why you should use this option.
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 ImageMagick where to
find them. For example, suppose you have the Windows fonts in the
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 ImageMagick'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
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 X_EXTRA_LIBS = 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 = DEFS = -DHAVE_CONFIG_H 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 ImageMagick that you downloaded. Check your output to make sure that ImageMagick 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
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
Once you're satisfied that you've configured ImageMagick the way you want it, enter these two commands:
make sudo make install
Check this page for in-depth information about installing ImageMagick.
The hard part is done. All we have to do now is install RMagick. Here you have two choices.
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.
Issue the command
sudo gem install rmagick
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
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 2.5.2 ($Date: 2008/08/24 21:17:09 $) Copyright (C) 2008 by Timothy P. Hunter Built with ImageMagick 6.4.3 2008-08-26 Q8 http://www.imagemagick.org Built for ruby 1.8.7 Web page: http://rmagick.rubyforge.org Email: firstname.lastname@example.org => nil
The RMagick HTML documentation is automatically installed at
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
This takes 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 ruby setup.rb install
The RMagick HTML documentation is automatically installed at
That's it. You should have a complete install of ImageMagick and RMagick.
Back to the FAQ.