Don’t you wanna feel the RMagick pain ? (or Guide to installing RMagick on Mac OS X)

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)!

Digg this or reddit it if it was useful to you!

40 Comments

Filed under ruby, tutorial

40 responses to “Don’t you wanna feel the RMagick pain ? (or Guide to installing RMagick on Mac OS X)

  1. i don’t see the point. can’t you use locomotive for development on you mac?

  2. I prefer to keep everything under control and install everything from source under /usr/local.

    See http://hivelogic.com/narrative/articles/using_usr_local

  3. 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

  4. Pingback: Daniel Fischer - Got Fisch? » Blog Archive » An even easier way to install RMagick for Ruby on Rails development

  5. 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.

  6. Pingback: VeronicasLore.com » A Simple Guide to Installing RMagick for Ruby on Rails on Mac OS X

  7. Paploo

    –with-quantum-depth=8

    That’s quite the LDFLAG.

  8. Pingback: Marc’s Guide to Installing RMagick on Mac OS X » StandoutJobs.com

  9. Or you could just download and run the rmagick-osx-installer script from http://rubyforge.org/projects/rmagick/

  10. 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!

  11. Pingback: Top Posts « WordPress.com

  12. 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.

  13. I’ll try this next time Peter, thanks for the pointer!

  14. glad it was helful to you Motorcycle Guy!

  15. Pingback: Ruby and Image Magick « 0ddn1x: tricks with *nix

  16. mike

    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.

  17. Jarpy

    Peter was right. “sudo port install rb-magick” worked with no pain at all.

    Thanks!

  18. Jarpy

    “sudo port install rb-rmagick” that is

  19. Pingback: Installing RMagick on Mac OS X : reinventar

  20. 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!

  21. Alex Marandon

    @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🙂

  22. Update:

    sudo port installl rb-rmagick

    Did not work for me. Had to compile everything by hand. Thanks again for the great writeup!

  23. 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).

  24. wooha! glad you found the joy of installing from source Heri🙂

  25. Adam

    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

  26. luca

    Great, now all works fine, imagemagick OK, RMagick OK.
    Thank you.
    Luca.

  27. Martin

    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.

  28. Pingback: MacOS » Blog Archive » A Simple Guide to Installing RMagick for Ruby on Rails on Mac OS X

  29. Pingback: codevader » Blog Archive » Installing RMagick on Mac

  30. murphy

    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

  31. Pingback: Top Soft News » A Simple Guide to Installing RMagick for Ruby on Rails on Mac OS X

  32. Pingback: Gary Haran.com » Installing RMagick Gem On OS X 10.5 (Leopard)

  33. Anybody else getting:

    mv: rename fonts/ to /usr/local/share/ghostscript/fonts/: No such file or directory

    You simple need to create the ghostscript directory first:

    sudo mkdir /usr/local/share/ghostscript

    I’ve posted an article on the changes I had to make to get this installed:

    http://utopia365.blogspot.com/2008/06/installing-rmagick-on-os-x.html

  34. Hey man !
    U did greatest tutorial for rmagick here !!

    Works for me well !!

    Thanks you alot !!!

  35. Randito

    If you are ever in Austin, I owe you a beer or frosty beverage of your choice.

  36. Michael Franzl

    Try Linux From Scratch, linuxfromscratch.org

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s