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.
October 27th, 2007 at 5:25 am
Thanks! That's just what I was looking into. It's great to see how issues are found and solved by the community.
October 27th, 2007 at 8:05 am
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?
October 27th, 2007 at 8:14 am
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!
October 28th, 2007 at 12:31 pm
[...] following the instructions at NullStyle [...]
October 28th, 2007 at 12:45 pm
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!
October 29th, 2007 at 9:04 pm
BryanD…. Do sudo port selfupdate to get 1.5.2 which will fix that issue.
October 30th, 2007 at 3:31 pm
[...] 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) [...]
November 1st, 2007 at 3:15 am
Thanks a TON!
November 7th, 2007 at 7:23 am
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!
November 8th, 2007 at 10:47 pm
[...] man mit MacPort RMagick installiert, ist hier schön [...]
November 12th, 2007 at 1:44 am
[...] 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 [...]
November 15th, 2007 at 9:31 pm
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!
November 15th, 2007 at 11:10 pm
Problem solved – install the apple developers package.
November 21st, 2007 at 3:18 am
[...] This post might help too: http://nullstyle.com/2007/10/27/how-to-build-imagemagick-and-install-rmagick-with-macports-on-mac-os... [...]
November 21st, 2007 at 6:20 pm
[...] 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 [...]
December 27th, 2007 at 6:18 am
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
January 13th, 2008 at 5:22 pm
[...] 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. [...]
July 19th, 2008 at 4:27 am
Thanks a lot for the hint! Worked perfectly for me!
August 2nd, 2008 at 7:07 am
Thanks !
August 10th, 2008 at 10:44 am
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
j
September 21st, 2008 at 7:37 pm
Good text!, bro
November 5th, 2008 at 3:04 pm
[...] 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 [...]
November 24th, 2008 at 10:06 pm
[...] 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. [...]
May 27th, 2009 at 2:50 pm
FYI – this worked for me:
sudo port install ImageMagick && sudo gem install rmagick
Perhaps a Leopard update fixed whatever wasn't working before…?
August 2nd, 2009 at 6:35 am
[...] Nach vielen Irrungen und Wirrungen hier die simple Lösung aus diesem Blog: [...]
February 11th, 2010 at 3:30 pm
Whoa dude you have got many odd error codes on your web site about parse error unexpected T String in line 15
April 28th, 2010 at 6:44 am
[...] 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 [...]
June 5th, 2010 at 1:01 am
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