Payday Loans Online

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

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.

28 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?


  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 . 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 "" | / 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. nruest Says:

    sudo port install tiff -macosx


    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?


  13. nruest Says:

    Problem solved – install the apple developers package.

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

    [...] This post might help too:… [...]

  15. Bradley Coudriet » Leopard, ImageMagick gem Says:

    [...]… Posted by Bradley Coudriet on Nov 21 2007 under web development, ruby, howto [...]

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

  17. Installing RMagick on Leopard : reinventar Says:

    [...] Unfortunately it’s still a game of luck, pacience and preseverance. Luckily I followed the tutorial at 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. [...]

  18. Andreas Gehret Says:

    Thanks a lot for the hint! Worked perfectly for me!

  19. renAbirero Says:

    Thanks !

  20. jomen Says:

    i had to set the path in /etc/paths.d to include "/opt/local/bin" for the "sudo gem install rmagick" to work

    otherwise alles gut, thanks


  21. Adhermedy Says:

    Good text!, bro

  22. Alan Bradburne » Blog Archive » Rails, MySQL and ImageMagick on OS X Leopard Says:

    [...] Just a note to myself for getting my other machines Rails environments up and running properly. Basically a collection of info from the Rails Weblog Angry Fly and NullStyle [...]

  23. Bookmarks for November 25th at dpwolf/blog Says:

    [...] How to build ImageMagick and install RMagick with MacPorts on Mac OS X Leopard | Educate. Liberate. – Guide to installing ImageMagick image processing tool from the command line using MacPorts. [...]

  24. Zubin Says:

    FYI – this worked for me:

    sudo port install ImageMagick && sudo gem install rmagick

    Perhaps a Leopard update fixed whatever wasn't working before…?

  25. rmagick auf Mac Leopard » 42online Says:

    [...] Nach vielen Irrungen und Wirrungen hier die simple Lösung aus diesem Blog: [...]

  26. Genevieve Fretwell Says:

    Whoa dude you have got many odd error codes on your web site about parse error unexpected T String in line 15

  27. Joe on Rails / 正在做的CaiTang.cc的软件与系统记录 Says:

    [...] and mini-magick with the instructions I found on this page but after some googling I found this blog post, which had the magic commands that worked for [...]

  28. Mike Says:

    RuntimeError (This installation of RMagick was configured with ImageMagick 6.5.9 but ImageMagick 6.6.2-0 is in use. ): /opt/local/lib/ruby/vendorruby/1.8/i686-darwin10/RMagick2.bundle /opt/local/lib/ruby/vendorruby/1.8/RMagick.rb:11 app/controllers/application_controller.rb:23:in <code>check_newPhoto' app/controllers/data_controller.rb:22:in</code>index'

    Using Mac 10.6.3 and do exactly what you say to do

    (I also have a problem with libjpeg.8.dylib is the new version and bundle ask libjpeg.7.dylib

Leave a Reply