ImageMagick and RMagick on Leopard and other Large White Cats 5

Posted by markm Tue, 11 Aug 2009 18:47:00 GMT

Credits

This how-too is originally from Pastie254887. It is just updated. And of course there is the small part about ensure it works with Snow Leopard (OS X 10.6).

As far as I know this is the ONLY way to get rmagick running on Snow Leopard until people update their scripts.

Installing ImageMagick and RMagick

In theory there is an install script that will do this all for you. It doesn’t work on Snow Leopard. Below are the steps to follow to actually get it done.

#!/bin/bash
#
# Install rmagick without fink or macports
#
# Requirements: Mac OS X >= 10.5.4, XCode 3.1, X11

#Install freetype

curl -O http://mirror.csclub.uwaterloo.ca/nongnu/freetype/freetype-2.3.9.tar.gz
tar xvf freetype-2.3.9.tar.gz
cd freetype-2.*
./configure --prefix=/usr/local
make
sudo make install
cd ..

#Install ghostscript fonts

curl -L -O 'http://prdownloads.sourceforge.net/gs-fonts/ghostscript-fonts-std-8.11.tar.gz'
tar xfz ghostscript-fonts-std-8.*.tar.gz
sudo mkdir -p /usr/local/share/ghostscript/
sudo mv fonts/ /usr/local/share/ghostscript/fonts/

#Install libjpeg (10.5 libjpeg won't work)

curl -O http://www.ijg.org/files/jpegsrc.v7.tar.gz
tar xfz jpegsrc.v7.tar.gz
cd jpeg-*
ln -s `which glibtool` ./libtool
export MACOSX_DEPLOYMENT_TARGET=10.5
./configure --enable-shared --prefix=/usr/local/libjpeg
make
sudo mkdir -p /usr/local/libjpeg/include
sudo mkdir -p /usr/local/libjpeg/lib
sudo mkdir -p /usr/local/libjpeg/bin
sudo mkdir -p /usr/local/libjpeg/man/man1
sudo make install
cd ..

#Install libpng (10.5 libpng won't work)

curl -L -O 'http://prdownloads.sourceforge.net/libpng/libpng-1.2.38.tar.gz'
tar xvf libpng-1.2.38.tar.gz
cd libpng-1*
./configure --enable-shared --prefix=/usr/local/libpng
make
sudo make install
cd ..

#Finally: Install ImageMagick and set correct symlinks

curl -O curl -O 'http://image_magick.veidrodis.com/image_magick/binaries/ImageMagick-6.5.3-9.tar.gz'
tar xvf ImageMagick-6.5.3-9.tar.gz
cd ImageMagick-6.*
export CPPFLAGS="-I/usr/local/libjpeg/include -I/usr/local/libpng/include -I/usr/local/include"
export LDFLAGS="-L/usr/local/libjpeg/lib -L/usr/local/libpng/lib -L/usr/local/lib -lpng"
./configure --prefix=/usr/local --with-modules \
  --without-perl --without-magick-plus-plus --with-quantum-depth=8 \
  --with-gs-font-dir=/usr/local/share/ghostscript/fonts
make
sudo make install
cd ..
sudo ln -s /usr/local/lib/libMagickCore.la /usr/local/lib/libMagick.la
sudo ln -s /usr/local/lib/libMagickCore.dylib /usr/local/lib/libMagick.dylib

#And top it off with RMagick
sudo gem install rmagick
Comments

Leave a comment

  1. Avatar
    Nick Jordan 3 days later:

    Trying the script out now, hopefully it works out. Been a pain in the ass getting rails dev set back up.

  2. Avatar
    Jason Fox 20 days later:

    I think there is a mistake in the last part of your tutorial where you install ImageMagick. You are downloading the binary distribution of ImageMagick instead of the source distribution and there is no configure in the extracted ImageMagick directory. I downloaded the source by following the instructions found here: http://www.imagemagick.org/script/install-source.php then continued with your tutorial and it worked fine.

  3. Avatar
    Alex Deva 21 days later:

    It didn’t work for me. I had to sudo the entire script, otherwise CC gave me some access right errors, and when all was done, “require ‘RMagick’” still didn’t work.

    I also tried installing ImageMagick from macports (after uninstalling and reinstalling lots of dependencies) and then compiling the rmagick gem; it compiled and installed, but not its examples, which failed with a “wrong architecture” error.

  4. Avatar
    markm 23 days later:

    Thanks Jason, I’ll look at that. I tried to compile the script after the fact and might have just grabbed the wrong link…

  5. Avatar
    omnivore about 1 month later:

    This seems to go fine until I get to the RMagick part: then, I get a lot of warnings like

    ld: warning: in /usr/local/lib/libexpat.dylib, file is not of required architecture
    CC utilities/compare.o
    CCLD utilities/compare
    ld: warning: in /usr/local/lib/libexpat.dylib, file is not of required architecture
    CC utilities/composite.o
    CCLD utilities/composite

    After that, when installing rmagick, I get lot of this:

    No definition for Info_initialize
    No definition for Info_channel
    No definition for rm_no_freeze
    No definition for Info_define

    although the gem shows as installed:

    $ gem list | grep ‘rmagick’
    rmagick (2.12.1)

    Any idea what’s going on here? BTW, I used the ftp source that Jason Fox pointed to, and then followed your recipe to unpack and configure.

Comments