If you’re bored at your next family party or are looking to light up a late night party with friends you should try installing RMagick on your Mac. It’s so rewarding when you finally go trough it 6 hours later, exhausted, hungry and with a sense of relief that make you feel like you could fly even after eating at Schwartz.
So here’s a little help to get the party started with installing RMagick on Mac OS X from source.
To setup this stuff at StandoutJobs, my starting point was the Hivelogic tutorial. Everyone seem to have the same error: Bus error. After a couple hours banging my head against our StandoutWalls™ I ended up bleeding from the ears and with this reviewed script:
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 ..
Now this part was missing from the original tutorial, ghostscript fonts are needed, get the package from http://sourceforge.net/projects/gs-fonts/ and
tar vzxf ghostscript-fonts-std-8.11.tar.gz
sudo mv fonts/ /usr/local/share/ghostscript/fonts/
Another missing was the oh-so-obvious (!) exporting of the variables: CPPFLAGS and LDFLAGS, summed up here for your own pleasure:
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
export CPPFLAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib
./configure --prefix=/usr/local \
--disable-static --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 ..
Now cross your fingers, get your rabit paw, make a little prayer and
sudo gem install RMagick
You’re done (or back to first step)!









i don’t see the point. can’t you use locomotive for development on you mac?
I prefer to keep everything under control and install everything from source under /usr/local.
See http://hivelogic.com/narrative/articles/using_usr_local
ok. i read the article. mmm i will still continue with locomotive.
– although one good thing about what you did is that it trains you when you’ll setup a linux server (for production). installing rmagick is nothing compared to that
You might also find it helpful to install many of your libraries using Fink. I did this for ghostscript, freetype, and a number other libraries, which cut down on the total install time significantly.
–with-quantum-depth=8
That’s quite the LDFLAG.
Or you could just download and run the rmagick-osx-installer script from http://rubyforge.org/projects/rmagick/
Even tought it’s quicker to install a prebuilt package you might get troubles later on and won’t know where your stuff is and how to fix em.
Thank you all for the comments and link love!
I did the same thing a couple of years ago and wrote some similar instructions up, but then I eventually found it’s a lot easier to port install imagemagick and then install the rmagick gem. That said, I’ve just noticed there’s a port called “rb-rmagick”.. wonder if that could turn it into a one liner
I’m surprised at all the bits and pieces surrounding the libjpeg install.. back when I did it last it was a bit easier, although it’s been a few months since I last did it that way.
I’ll try this next time Peter, thanks for the pointer!
This is an amazing guide!
glad it was helful to you Motorcycle Guy!
I tried it multiple times, from various angles and it always crapped the hell out on me .. I spent a good day and a half going through this and in the end just put RMagick in my FUKKET file.
I will not use RMagick. That is it! I don’t care if I can’t do the cool stuff.. the thing was just too hairy to install on osx. It might be a bit easier with the dmg installer and whatnot, but I tried the longer way (port++) and just didn’t have any luck whatsoever…
It was one of the most frustrating install experiences of my mac existenz! I hope it is better now. I will NEVER use ImageMagick EVER again.
Peter was right. “sudo port install rb-magick” worked with no pain at all.
Thanks!
“sudo port install rb-rmagick” that is
mike - I definitely know the feeling.
I personally don’t get the obsession with RMagick.
You can install ImageMagick (a lot easier) and simply write a few wrappers for the necessary command-line functions you need to call from it.
Marc - thanks for the writeup!
ps. I’m surprised ’sudo port installl rb-rmagick’ works so easily. think I’ll give that a try first!
@mike
Please don’t blame ImageMagick, it’s a very nice package that causes no trouble to billions (according to my latest statistics) of happy Linux and BSD users
Update:
sudo port installl rb-rmagick
Did not work for me. Had to compile everything by hand. Thanks again for the great writeup!
ok THANKS - i used this guide because I upgraded to ruby 1.8.6
and I discovered with horror that when you upgrade ruby, you have to reinstall everything else (rubygem, rails, ImageMagick and all other gems you are using).
wooha! glad you found the joy of installing from source Heri
Great article, especiall as Hivelogic’s Rmagick tutorial is down. I feel I’m so close to the holy grail but after running make on the image magick install, I get:
magick/type.c: In function ‘LoadFontConfigFonts’:
magick/type.c:643: error: ‘FC_WIDTH’ undeclared (first use in this function)
magick/type.c:643: error: (Each undeclared identifier is reported only once
magick/type.c:643: error: for each function it appears in.)
magick/type.c:651: warning: implicit declaration of function ‘FcFini’
magick/type.c:689: error: ‘FC_WIDTH_ULTRACONDENSED’ undeclared (first use in this function)
magick/type.c:691: error: ‘FC_WIDTH_EXTRACONDENSED’ undeclared (first use in this function)
magick/type.c:693: error: ‘FC_WIDTH_CONDENSED’ undeclared (first use in this function)
magick/type.c:695: error: ‘FC_WIDTH_SEMICONDENSED’ undeclared (first use in this function)
magick/type.c:697: error: ‘FC_WIDTH_NORMAL’ undeclared (first use in this function)
magick/type.c:699: error: ‘FC_WIDTH_SEMIEXPANDED’ undeclared (first use in this function)
magick/type.c:701: error: ‘FC_WIDTH_EXPANDED’ undeclared (first use in this function)
magick/type.c:703: error: ‘FC_WIDTH_EXTRAEXPANDED’ undeclared (first use in this function)
magick/type.c:705: error: ‘FC_WIDTH_ULTRAEXPANDED’ undeclared (first use in this function)
magick/type.c:708: error: ‘FC_WEIGHT_THIN’ undeclared (first use in this function)
magick/type.c:710: error: ‘FC_WEIGHT_EXTRALIGHT’ undeclared (first use in this function)
magick/type.c:714: error: ‘FC_WEIGHT_NORMAL’ undeclared (first use in this function)
magick/type.c:722: error: ‘FC_WEIGHT_EXTRABOLD’ undeclared (first use in this function)
magick/type.c:605: warning: unused parameter ‘exception’
make: *** [magick/magick_libMagick_la-type.lo] Error 1
Any ideas? Everything else installed faultlessly and I’ve got ghostscript and ghostscript fonts.
Cheers
Adam
Great, now all works fine, imagemagick OK, RMagick OK.
Thank you.
Luca.
Thanks for the nice instructions.
I could not get libjpeg to configure on my intel 10.4 OS with your steps, but these worked:
http://snippets.dzone.com/posts/show/38
Maybe they’ll help someone.
I can’t get past this step?
harrel-blatts-computer:~/desktop harrelblatt$ sudo mv fonts/ /usr/local/share/ghostscript/fonts/
mv: rename fonts/ to /usr/local/share/ghostscript/fonts/: No such file or directory