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!

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


  1. 1 heri June 19, 2007 at 4:19 pm

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

  2. 2 macournoyer June 19, 2007 at 4:25 pm

    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. 3 heri June 19, 2007 at 9:55 pm

    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. 4 Ryan June 20, 2007 at 3:06 pm

    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.

  5. 5 Paploo June 20, 2007 at 3:10 pm

    –with-quantum-depth=8

    That’s quite the LDFLAG.

  6. 6 Lori Olson June 20, 2007 at 6:07 pm

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

  7. 7 macournoyer June 20, 2007 at 6:51 pm

    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!

  8. 8 Peter Cooper June 21, 2007 at 8:27 am

    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.

  9. 9 macournoyer June 21, 2007 at 9:18 am

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

  10. 10 Motorcycle Guy June 21, 2007 at 4:44 pm

    This is an amazing guide!

  11. 11 macournoyer June 22, 2007 at 8:23 am

    glad it was helful to you Motorcycle Guy!

  12. 12 mike June 24, 2007 at 8:59 pm

    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.

  13. 13 Jarpy July 9, 2007 at 9:13 am

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

    Thanks!

  14. 14 Jarpy July 9, 2007 at 9:14 am

    “sudo port install rb-rmagick” that is

  15. 15 Shanti Braford July 25, 2007 at 2:42 pm

    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!

  16. 16 Alex Marandon July 28, 2007 at 9:20 pm

    @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 :-)

  17. 17 Shanti Braford August 6, 2007 at 4:15 pm

    Update:

    sudo port installl rb-rmagick

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

  18. 18 heri August 16, 2007 at 2:35 pm

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

  19. 19 macournoyer August 16, 2007 at 4:02 pm

    wooha! glad you found the joy of installing from source Heri :)

  20. 20 Adam August 25, 2007 at 5:23 am

    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

  21. 21 luca August 30, 2007 at 7:50 am

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

  22. 22 Martin October 3, 2007 at 1:34 pm

    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.

  23. 23 murphy October 22, 2007 at 12:08 am

    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

  1. 1 Daniel Fischer - Got Fisch? » Blog Archive » An even easier way to install RMagick for Ruby on Rails development Trackback on June 20, 2007 at 2:33 pm
  2. 2 VeronicasLore.com » A Simple Guide to Installing RMagick for Ruby on Rails on Mac OS X Trackback on June 20, 2007 at 3:07 pm
  3. 3 Marc’s Guide to Installing RMagick on Mac OS X » StandoutJobs.com Trackback on June 20, 2007 at 3:51 pm
  4. 4 Top Posts « WordPress.com Trackback on June 20, 2007 at 6:58 pm
  5. 5 Ruby and Image Magick « 0ddn1x: tricks with *nix Trackback on June 23, 2007 at 12:46 pm
  6. 6 Installing RMagick on Mac OS X : reinventar Trackback on July 24, 2007 at 10:32 am
  7. 7 MacOS » Blog Archive » A Simple Guide to Installing RMagick for Ruby on Rails on Mac OS X Trackback on October 9, 2007 at 9:26 am
  8. 8 codevader » Blog Archive » Installing RMagick on Mac Trackback on October 15, 2007 at 8:11 am
  9. 9 Top Soft News » A Simple Guide to Installing RMagick for Ruby on Rails on Mac OS X Trackback on November 3, 2007 at 8:11 am
  10. 10 Gary Haran.com » Installing RMagick Gem On OS X 10.5 (Leopard) Trackback on December 11, 2007 at 2:18 pm

Leave a Reply




RefactorMyCode.comrefactorer Recommend Me

Top Clicks

  • None
Top Blogues page counter Add to Technorati Favorites

Blog Stats

  • 84,985 hits