How to build ImageMagick and install RMagick with MacPorts on Mac OS X Leopard

October 27th, 2007

Oh holy day, brand new operating system for me to poke my grubby little fingers at!

Leopard is a piece of work that is for sure, but for some of us getting back to the bliss that was the Rails development environment on Tiger will take a little doing. In today’s journey will get RMagick running again.

Apple has provided us with a near complete rails environment out of the box, but there are two big missing pieces: the mysql gem, and rmagick.

Normally, we would simply install rmagick with:

sudo port install ImageMagick
sudo gem install rmagick

But it turns out the tiff port in macports fails to build when using apples new implementation of opengl in leopard. so:

Getting RMagick, Leopard-Style

sudo port install tiff -macosx  #disables the linkage with Apple's open gl
sudo port install ImageMagick
sudo gem install rmagick

Simple as that.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • DZone
  • Digg
  • Reddit
  • del.icio.us
  • Blue Dot
  • StumbleUpon
  • Netscape
  • Ma.gnolia
  • Slashdot
  • Technorati
  • NewsVine
  • Netvouz

18 Responses to “How to build ImageMagick and install RMagick with MacPorts on Mac OS X Leopard”

  1. Stephan Says:

    Thanks! That’s just what I was looking into. It’s great to see how issues are found and solved by the community.

  2. Jordi Says:

    But is that using Apple’s ruby and rubygems, or MacPorts? I figured out the -macosx part, but my gem won’t build. Bitching about missing freetype, which is installed.

    Which ruby were you using?

  3. Jordi Says:

    Nevermind. I did sudo port install ImageMagick +no_x11, which means I had to do sudo port install ghostscript as well before installing the gem. Problem solved!

  4. InVisible Blog » Rails Stack on Leopard Says:

    […] following the instructions at NullStyle […]

  5. BryanD Says:

    I’m running into an issue when trying to install ImageMagick. I get the following error:

    sudo port install ImageMagick Error: Unable to execute port: invalid command name “destroot.violate_mtree”

    Any idea what’s going on?

    Thanks!

  6. Greg Says:

    BryanD…. Do sudo port selfupdate to get 1.5.2 which will fix that issue.

  7. napyfab:blog» Blog Archive » links for 2007-10-30 Says:

    […] How to build ImageMagick and install RMagick with MacPorts on Mac OS X Leopard | Educate. Liberate. (tags: leopard ruby imagemagick rmagick mac rubyonrails osx rails macports gems guide) […]

  8. aiwilliams Says:

    Thanks a TON!

  9. jonathan Says:

    I did the steps above, but this I got a “cannot find libMagick” error. Does anyone have any ideas?

    jonathan@:~$ sudo gem install rmagick Password: Need to update 1 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 gem_extconf.rb install rmagick

    sh configure

    Configuring RMagick 1.15.10 checking for gcc… gcc checking for C compiler default output file name… a.out checking whether the C compiler works… yes checking whether we are cross compiling… no checking for suffix of executables… checking for suffix of object files… o checking whether we are using the GNU C compiler… yes checking whether gcc accepts -g… yes checking for gcc option to accept ISO C89… none needed checking for gcc option to accept ISO C99… -std=gnu99 checking for gcc -std=gnu99 option to accept ISO Standard C… (cached) -std=gnu99 checking for ruby… /usr/bin/ruby checking for Magick-config… Magick-config checking for InitializeMagick in -lMagick… no configure: error: Can’t install RMagick. Can’t find libMagick or one of the dependent libraries. Check the config.log file for more detailed information. RMagick configuration failed with status 1.

    Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/rmagick-1.15.10 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-1.15.10/gem_make.out

    jonathan:~$ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/bin:/usr/texbin:/opt/local/bin:/opt/local/sbin

    I went to config.log and saw this part above when it exited:

    ld: library not found for -ltiff collect2: ld returned 1 exit status configure:3243: $? = 1 configure: failed program was: | /* confdefs.h. / | #define PACKAGENAME “RMagick” | #define PACKAGETARNAME “RMagick-1.15.10.tar.gz” | #define PACKAGEVERSION “1.15.10″ | #define PACKAGESTRING “RMagick 1.15.10″ | #define PACKAGE_BUGREPORT “rmagick@rubyforge.org” | / end confdefs.h. / | | / Override any GCC internal prototype to avoid an error. | Use char because int might match the return type of a GCC | builtin and then its argument prototype would still apply. */ | #ifdef __cplusplus | extern “C” | #endif | char InitializeMagick (); | int | main () | { | return InitializeMagick (); | ; | return 0; | }

    Any help would be appreciated!

  10. Ruby on Rails with Leopard (localhost, sites, apache, mysql, rmagick) at funkensturm. | Blog Says:

    […] man mit MacPort RMagick installiert, ist hier schön […]

  11. HowTo: ImageMagick + RMagick via Macports für Tiger at funkensturm. | Blog Says:

    […] nun auch RMagick für ein aktuelles Projekt brauchte, dachte ich ich nehm einfach die Anleitung von hier (ok steht ja schon im Posttitel ist für Leopard und nicht für Tiger) Das hat natürlich nicht […]

  12. Attila Says:

    Hi!

    Little bit different topic, but i tried to install rail mail, and the repo is not online! Could you make it alive?

    Thanks!

  13. nruest Says:

    sudo port install tiff -macosx

    yields:

    Error: Target org.macports.configure returned: configure failure: shell command ” cd “/opt/local/var/macports/build/optlocalvarmacportssourcesrsync.macports.orgreleaseportsgraphicsjpeg/work/jpeg-6b” && ./configure –prefix=/opt/local –enable-shared –enable-static ” returned error 1 Command output: checking for gcc… no checking for cc… no configure: error: no acceptable cc found in $PATH

    any ideas?

    thanks!

  14. nruest Says:

    Problem solved - install the apple developers package.

  15. Teabass - Andrew Nesbitt's Blog » Super Simple Ruby on Rails Install with MacPorts (for Leopard) Says:

    […] This post might help too: http://nullstyle.com/2007/10/27/how-to-build-imagemagick-and-install-rmagick-with-macports-on-mac-os… […]

  16. Bradley Coudriet » Leopard, ImageMagick gem Says:

    […] http://nullstyle.com/2007/10/27/how-to-build-imagemagick-and-install-rmagick-with-macports-on-mac-os… Posted by Bradley Coudriet on Nov 21 2007 under web development, ruby, howto […]

  17. Adam Hutchison Says:

    Just a heads-up… After solving the GCC issues by installing Xcode 3.0, I had some other issues getting this installed due to a missing GNUTAR in /usr/bin. For some reason, it was not existent on my factory Leopard install. I can’t be sure that it wasn’t there and somehow removed, but copying getting a copy of TAR from a Tiger install and dropping it into /usr/bin did the trick. Also, be sure to symlink tar to gnutar (ln -s /usr/bin/tar /usr/bin/gnutar), as MacPorts looks for /usr/bin/gnutar

  18. Installing RMagick on Leopard : reinventar Says:

    […] Unfortunately it’s still a game of luck, pacience and preseverance. Luckily I followed the tutorial at onRails.org and managed to get things running after some time installing everything by hand from the source.  I guess the alternative would be to use something like MacPorts to install RMagick. […]

Leave a Reply