Step 1. Install X11, the Xcode Tools, and the X11SDK.
×Magick needs the X11 fonts and a X server to display images, so
you'll need to install X11. You also need the Xcode tools and the
X11SDK.
Install X11, the Xcode Tools and the X11SDK. from the OS X
installation disk. See http://developer.apple.com/darwin/runningX11.html
for more information.
Step 2. Install DarwinPorts
Go to http://darwinports.opendarwin.org/getdp/
and follow the instructions to download and install DarwinPorts.
The remainder of this document assumes that you take all the
defaults during the installation. In particular, the default
location for installing the delegate libraries is the
/opt/local
directory.
Step 3: Install the delegate libraries
Here we'll use DarwinPorts to install delegates for popular
image formats and that are needed to run the RMagick example
programs. Enter the following port commands:
sudo port install jpeg
sudo port install libpng
sudo port install libwmf
sudo port install tiff (see note below)
sudo port install lcms
sudo port install freetype
sudo port install ghostscript
(Our correspondent Al E. reports that as of this writing
libtiff 3.8.0, the most recent version of libtiff available from
DarwinPorts, is completely broken. Al recommends installing
libtiff 3.8.1
or later. 23Mar2006)
Note that some of these libraries have prerequisites which will
be automatically installed.
Before proceeding, you need to make sure you're using the
correct version of the FreeType library. The X11 files
you installed in Step 1 include a version of the
FreeType library, and of course you just installed
another version in
/opt/local
using
DarwinPorts. You need to use the DarwinPorts version when you're
building ×Magick. To make sure you have the right version, enter
the command:
freetype-config --cflags
You should see this output:
-I/opt/local/include/freetype2 -I/opt/local/include
If you see the following output instead,
-I/usr/X11R6/include -I/usr/X11R6/include/freetype2
edit your $PATH to make sure that /opt/local/bin
preceeds /usr/X11R6/bin. Do not try to install ×Magick
until you get the correct output from the freetype-config
program.
Step 4: Install ImageMagick or GraphicsMagick
Go to http://www.imagemagick.org or
http://www.graphicsmagick.org
and download the latest version of the software to a temporary
directory. Unroll the tarball and make the new 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
To configure ×Magick, enter these commands:
export CPPFLAGS=-I/opt/local/include
export LDFLAGS=-L/opt/local/lib
./configure --prefix=/opt/local --disable-static --with-modules --without-perl \
--without-magick-plus-plus --with-quantum-depth=8 \
--with-gs-font-dir=/opt/local/share/ghostscript/fonts
The ./configure command should be entered on a
single line. The --prefix=/opt/local option will cause
×Magick to be installed in the same directory as the libraries we
installed with DarwinPorts. If you want to install ×Magick
somewhere else, specify a different directory. If you do not
specify the --prefix option ×Magick will be installed in
/usr/local. The --disable-static and --with-modules
options cause ×Magick to be built with dynamically loaded modules.
Since you're installing ×Magick for use with Ruby, I've included
the --without-perl and --without-magick-plus-plus options to
suppress the Perl and C++ support. The --with-quantum-depth=8
option configures ×Magick to use a bit depth of 8. If you need to
build with a different bit depth (and if you need to you'll already
know it) you can specify 16 or 32. Finally, the --with-gs-font-dir
option tells ×Magick where the Ghostscript fonts are installed.
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 deafults, the output from
configure should end with a page like this:
ImageMagick is configured as follows. Please verify that this configuration matches your expectations.
Host system type : powerpc-apple-darwin7.8.0
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=no no
Quantum depth --with-quantum-depth=8 8
Delegate Configuration:
BZLIB --with-bzlib=yes yes
DPS --with-dps=yes yes
FlashPIX --with-fpx=no no
FreeType 2.0 --with-ttf=yes yes
Ghostscript None gs (8.14)
Ghostscript fonts --with-gs-font-dir=/opt/local/share/ghostscript/fonts /opt/local/share/ghostscript/fonts/
Ghostscript lib --with-gslib=no no
Graphviz --with-dot=yes no
JBIG --with-jbig=yes no
JPEG v1 --with-jpeg=yes yes
JPEG-2000 --with-jp2=yes no
LCMS --with-lcms=yes yes
Magick++ --with-magick-plus-plus=no no
PERL --with-perl=no no
PNG --with-png=yes yes
TIFF --with-tiff=yes yes
Windows fonts --with-windows-font-dir=none
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 = /opt/local
EXEC-PREFIX = /opt/local
VERSION = X.Y.Z
CC = gcc
CFLAGS = -g -O2 -Wall
CPPFLAGS = -I/opt/local/include
PCFLAGS =
DEFS = -DHAVE_CONFIG_H
LDFLAGS = -L/opt/local/lib -L/opt/local/lib -L/usr/X11R6/lib -L/opt/local/lib -lfreetype -lz -L/usr/lib
LIBS = -lMagick -llcms -ltiff -lfreetype -ljpeg -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lpthread -lm -lpthread
CXX = g++
CXXFLAGS =
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 bzlib,
FreeType 2.0, JPEG v1, LCMS, PNG, TIFF, WMF, X11, XML, and
ZLIB.
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:
make
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 5: Install RMagick
The hard part is done. All we have to do now is install RMagick.
If you haven't already done so, download the RMagick tarball from
Rubyforge and unroll it into a temporary directory. Make that
directory current.
tar xvzf RMagick-X.Y.Z.tar.gz
cd RMagick-X.Y.Z
Enter these commands
./configure
make
sudo make install