Dan Benjamin

Yes, you’re in the right place. Hivelogic has merged with DanBenjamin.com, and its content now lives here. Watch this space for details.

Building RMagick on Mac OS X

There are many cool things you can do with the RMagick gem. Unfortunately, it has a handful of pre-requisites that are hard to track down. Worse, some packages have “issues” with Mac OS X, so finding just the right combination of versions can be tricky.

Because there’s nothing fun or interesting about building and installing the prerequisites, I’m providing the instructions for you below in one big block. You shouldn’t see any errors, and you can ignore most of the output. If all goes well, after about an hour, you’ll have a working installation of RMagick on OS X installed correctly into /usr/local (why this is important).


curl -O http://download.savannah.gnu.org/releases/\
freetype/freetype-2.1.10.tar.gz
tar xzvf freetype-2.1.10.tar.gz
cd freetype-2.1.10
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://superb-west.dl.sourceforge.net/\
sourceforge/libpng/libpng-1.2.10.tar.bz2
bzip2 -dc libpng-1.2.10.tar.bz2 | tar xv
cd libpng-1.2.10
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz
tar xzvf jpegsrc.v6b.tar.gz
cd jpeg-6b
ln -s `which glibtool` ./libtool
export MACOSX_DEPLOYMENT_TARGET=10.4
./configure --enable-shared --prefix=/usr/local
make
sudo make install
cd ..

curl -O ftp://ftp.remotesensing.org/libtiff/tiff-3.8.2.tar.gz
tar xzvf tiff-3.8.2.tar.gz
cd tiff-3.8.2
./configure --prefix=/usr/local
make
sudo make install
cd ..

curl -O http://easynews.dl.sourceforge.net/\
sourceforge/imagemagick/ImageMagick-6.3.0-0.tar.gz
tar xzvf ImageMagick-6.3.0-0.tar.gz
cd ImageMagick-6.3.0
./configure --prefix=/usr/local
make
sudo make install
cd ..

sudo gem install rmagick

That’s it, you should have RMagick installed!

Comments

mike ·

sh-3.2# curl -O ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz

curl: (67) Access denied: 530
sh-3.2#

??

mike ·

so just for the other not so bright people out there....
i just downloaded it using my browser (by putting ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz up in the top here, ha)
and moved it to /usr/local myself and proceeded

Seb ·

Worked fine up until the very last step "sudo gem install RMagick"...

Any ideas on the following error, thanks.

Need to update 42 gems from http://gems.rubyforge.org
..........................................
complete
Building native extensions. This could take a while...
ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby extconf.rb install RMagick
checking for Ruby version >= 1.8.2... yes
checking for Magick-config... no
Can't install RMagick 2.2.2. Can't find Magick-config in /opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Scott Johnson of Education Revolution ·

Hey,

Thanks for the wonderful instructions. As of 3/08 works great. One thing tho -- the last step, installing from the gem, fails as written above. It needs to be:

sudo gem install rmagick

cory ·

Thanks for this. Worked great except the last part which had to be changed as a post above described.

Sorry, comments have been closed.