Installing RMagick on Leopard (without MacPorts or Fink) 42

Posted by Solomon White Sat, 03 Nov 2007 00:07:00 GMT

I’ve recently upgraded to OS X 10.5 (Leopard), and all-in-all, I’m pleased with the experience. My biggest issue has been the default stacks behavior—the icon changes to the last thing added to the stack, making visual identification unnecessarily cumbersome. I worked around this annoyance (as outlined here) by changing the sort to name rather than date added, and adding a dummy folder named “_1” that will sort to the top. For extra bonus points, I customized the icon of the dummy folder. For some yet unknown reason, the most recently downloaded item still peeks through from time to time, but it’s much better than before.

Maybe it’s my Windows history showing through, but I went with the “clean-sweep” erase and install method. For a non-developer, I’d probably recommend the upgrade (and in fact I used that method for my Father-in-law’s MacBook), but I had lots of custom bits scattered about my machine, and didn’t want to be chasing any incompatibility gremlins.

So now, to get my development environment set up on the new machine… Leopard includes a fairly complete Rails stack out of the box, with a non-broken Ruby, readline support, and most of the commonly used gems. Read more here.

MySQL was not included, but the latest installer (mysql-5.0.45-osx10.4-i686.dmg) for 10.4 from dev.mysql.com downloads worked (mostly) fine. The Server and the StartupItem install and operate correctly. The PrefPane installs, but does not appear to actually do … anything. I’ll have to work on that, but I can live without it for now. After a bit of manual hacking on my database dump file from Tiger (where I was running a 5.1.x beta of MySQL), all my databases are back in place.

One last piece that I needed for my Rails apps—RMagick. I know it’s possible to install RMagick and its dependencies, um, “autoRMagickally” via a package management system like MacPorts or Fink, but I prefer not to. For some background on why not, you can read this article at hivelogic. The last time I was rebuilding my laptop and desktop near the same time, I put together a shell script to automate the process of installing RMagick. I got it back out and dusted off the cobwebs, and voila! RMagick on Leopard. (note: replace wget with “curl -O”, if you don’t have wget installed on your machine) Here’s the code:

install_rmagick.sh
#!/bin/sh
wget http://download.savannah.gnu.org/releases/freetype/freetype-2.3.5.tar.gz
tar xzvf freetype-2.3.5.tar.gz
cd freetype-2.3.5
./configure --prefix=/usr/local
make
sudo make install
cd ..

wget http://superb-west.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.22.tar.bz2
tar jxvf libpng-1.2.22.tar.bz2
cd libpng-1.2.22
./configure --prefix=/usr/local
make
sudo make install
cd ..

wget 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.5
./configure --enable-shared --prefix=/usr/local
make
sudo make install
cd ..

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

wget http://jaist.dl.sourceforge.net/sourceforge/wvware/libwmf-0.2.8.4.tar.gz
tar xzvf libwmf-0.2.8.4.tar.gz
cd libwmf-0.2.8.4
make clean
./configure
make
sudo make install
cd ..

wget http://www.littlecms.com/lcms-1.17.tar.gz
tar xzvf lcms-1.17.tar.gz
cd lcms-1.17
make clean
./configure
make
sudo make install
cd ..

wget ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/gs860/ghostscript-8.60.tar.gz
tar zxvf ghostscript-8.60.tar.gz
cd ghostscript-8.60/
./configure  --prefix=/usr/local
make
sudo make install
cd ..

wget ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/current/ghostscript-fonts-std-8.11.tar.gz
tar zxvf ghostscript-fonts-std-8.11.tar.gz
sudo mv fonts /usr/local/share/ghostscript

wget http://imagemagick.site2nd.org/imagemagick/ImageMagick-6.3.5-9.tar.gz
tar xzvf ImageMagick-6.3.5-9.tar.gz
cd ImageMagick-6.3.5
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 ..

sudo gem install RMagick
Comments

Leave a response

  1. jim Sat, 03 Nov 2007 12:11:21 GMT

    you can replace wget with “curl -O” since wget ins’t installed by default on Leopard.

  2. gissmoh Sat, 03 Nov 2007 12:39:45 GMT

    there’s a problem with the hostname:

    -13:34:46- http://imagemagick.site2nd.org/imagemagick/ImageMagick-6.3.5-9.tar.gz => `ImageMagick-6.3.5-9.tar.gz’ Auflösen des Hostnamen »imagemagick.site2nd.org«…. 208.101.21.223 Verbindungsaufbau zu imagemagick.site2nd.org|208.101.21.223|:80… fehlgeschlagen: Operation timed out. Erneuter Versuch.

    -13:36:02- http://imagemagick.site2nd.org/imagemagick/ImageMagick-6.3.5-9.tar.gz (Versuch: 2) => `ImageMagick-6.3.5-9.tar.gz’ Verbindungsaufbau zu imagemagick.site2nd.org|208.101.21.223|:80… fehlgeschlagen: Operation timed out. Erneuter Versuch.

  3. gissmoh Sat, 03 Nov 2007 12:57:22 GMT

    wget http://imagemagick.site2nd.org/imagemagick/ImageMagick-6.3.5-9.tar.gz tar xzvf ImageMagick-6.3.5-9.tar.gz

    does not work … unknown host!!

    I replaced it with:

    wget ftp://ftp.fu-berlin.de/unix/X11/graphics/ImageMagick/ImageMagick-6.3.6-4.tar.gz tar xzvf ImageMagick-6.3.6-4.tar.gz cd ImageMagick-6.3.6 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

    ...and everything works fine….

  4. Solomon Sat, 03 Nov 2007 14:58:46 GMT

    @jim: yes, I installed wget before setting up RMagick, but “curl -O” works for a stock installation.

    @gissmoh : yes, this script uses mirrors that are close to me. YMMV depending on prevailing network conditions.

    Thanks for the updates!

  5. Ryan Stout Thu, 08 Nov 2007 20:20:29 GMT

    I just wanted to say thanks, this script saved me a lot of thinking. I can’t believe the whole script worked fine. Having been on linux for so long, I just expected something to go wrong. I guess that’s the benefit of not having a bunch of different distros.

  6. John Smith Sat, 10 Nov 2007 11:27:32 GMT

    Many thanks for compiling all the necessary dependencies in one place. It was a nightmare trying get rmagik to work when I got my laptop last December.

  7. Chris Griffin Sat, 10 Nov 2007 22:20:51 GMT

    The original ftp url for the jpeg lib gave me a authorization error so I substituted:

    http://www.ijg.org/files/jpegsrc.v6b.tar.gz

    And the forces of goodness and niceness triumph once again.

  8. sweeeeeeeet! Tue, 13 Nov 2007 16:39:14 GMT

    Nice work.

  9. rebo Wed, 14 Nov 2007 13:52:05 GMT

    Can I just say many thanks for this, this is one of the few multi install scripts that I have used that have worked right off of the bat.

    Nice one!

  10. Nick Thu, 15 Nov 2007 19:50:06 GMT

    Thanks a lot for this script—this was my first time installing RMagick and it went very smoothly (after fixing the URLs for the JPEG and Ghostscript fonts downloads). From what I read online about installing RMagick, you just saved me A LOT of time. Thanks!

  11. Tim Thu, 15 Nov 2007 21:42:48 GMT

    Got everything installed…. Rmagick shows in my gems, but when I require ‘remagick’ I get “no such file to load — rmagick”. Any thoughts from anyone reading this?

  12. Lee Thu, 15 Nov 2007 21:45:34 GMT

    @Tim: you need to require ‘RMagick’, notice the capitalization

  13. Tim Thu, 15 Nov 2007 21:52:32 GMT

    @Lee: I previously tried that too… Here is my interaction in irb.

    irb(main):001:0> require ‘RMagick’
    LoadError: no such file to load—RMagick
         from (irb):1:in `require’
         from (irb):1
    irb(main):002:0>

  14. Josh Thu, 15 Nov 2007 23:09:45 GMT

    awesome. nice work. took like 20 minutes on my 2GHz macbook, but seems to have worked…

  15. Tim Fri, 16 Nov 2007 05:51:45 GMT

    Even after make uninstalling and retrying I wasn’t successful. While I never got an error I could not require RMagick into Ruby… I did a bit of searching and found that is a Ruby script that came out on 11/4/07 on RubyForge that worked perfectly. It automatically downloads everything you need and worked awesome:

    http://rubyforge.org/frs/?group_id=12&release_id=16101

  16. Gravitas Mon, 19 Nov 2007 01:54:44 GMT

    SetupRailsonLeopard. I just completed my Rails setup, thanks Tim you rock, this is the quick rundown on it.

  17. jm Tue, 20 Nov 2007 08:52:59 GMT

    A good link to compile wget once and for all on leopard : http://radio.javaranch.com/bear/2005/03/02/1109829480523.html

    Thanks for this script !

  18. kematzy Fri, 23 Nov 2007 09:26:42 GMT

    Thanks a lot!! Worked a treat apart from the URL issues which were commented about above.

  19. Simon Plenderleith Wed, 28 Nov 2007 17:37:53 GMT

    Dude… you are an absolute saviour! I’ve been going crazy trying to get ImageMagick working as I want it in Leopard. I changed the URLs as required and it worked great.

    Thank you so much!

  20. Markus Arike Fri, 30 Nov 2007 18:56:30 GMT

    I had great success with the rm_install.rb script that is available at RubyForge’s RMagick http://rmagick.rubyforge.org/ page . It automates the process, much like the above script, but seems to do more clean up, error handling, etc. After trying to get it working on OSX for so long, to no avail, I finally have it. It’s good day.

  21. Patrick Sat, 08 Dec 2007 04:57:24 GMT

    thanks so much, worked like a champ.

  22. Robert Aganauskas Mon, 10 Dec 2007 05:26:03 GMT
    @Tim: you have to require rubygems before rmagick i.e.
    irb(main):001:0> require 'rubygems'
    => true
    irb(main):002:0> require 'RMagick'
    => true
    
  23. Dave Frey Mon, 28 Jan 2008 23:11:18 GMT

    Excellent, thanks a lot.

    Your ImageMagick link was broken for me, but I found another here: http://ftp.surfnet.nl/pub/ImageMagick/ImageMagick-6.3.5-9.tar.gz

  24. Justin Grevich Wed, 27 Feb 2008 22:55:08 GMT

    @Tim

    You may also need to require ‘rubygems’ before requiring RMagick in irb (depending if you are using an .irbrc or not). Somehow my OS X install of Ruby auto-installed an .irbrc for me. I posted an example of it here: http://pastie.org/158471

    Hope that helps,

    justin

  25. Peter Fri, 29 Feb 2008 20:26:44 GMT

    hmmm, when i follow this guide, i eventually get this at the end (after gem install RMagick): ERROR: could not find RMagick locally or in a repository

    any ideas/

  26. Adam Sun, 09 Mar 2008 00:12:39 GMT

    @Peter: If you didn’t figure this out already, the gem is in fact called ‘rmagick’, so “sudo gem install rmagick” should work for you.

  27. Julie Tue, 11 Mar 2008 16:54:31 GMT
  28. nick Tue, 08 Apr 2008 10:30:47 GMT

    Thank you very much! Everything worked! :)

  29. Lance Carlson Mon, 05 May 2008 05:55:31 GMT

    I think it’s sudo gem install rmagick not RMagick. Otherwise everything worked pretty well with the urls from Julie.

  30. Huy Tong Tue, 06 May 2008 16:24:28 GMT

    Nice script. I did the steps and it didn’t work on my end. Something about the headers. I’m trying the OSX installer now provided on the forge, I think it pretty much does what your script does but I’ll wait and see.

  31. D. Starr Fri, 06 Jun 2008 17:28:07 GMT

    Hi, I’m just wondering why you didn’t compile Ghostscript as a framework (which seems to be the recommended way) and if you’ve tested that your IM can actually call GS to delegate vector formats.

  32. D. Starr Fri, 06 Jun 2008 17:28:12 GMT

    Hi, I’m just wondering why you didn’t compile Ghostscript as a framework (which seems to be the recommended way) and if you’ve tested that your IM can actually call GS to delegate vector formats.

  33. Bob F. Wed, 30 Jul 2008 00:05:13 GMT

    This worked pretty well on a brand new Leopard system. I used curl and adjusted some URLs, as mentioned by others already.

    I’d like to point out two problems:

    1. It’s important you build a later version of libpng, as there’s a vulnerability in the version given here.
    2. If you see this error during the installation phase of the jpeg ”/usr/local/man/man1/cjpeg.1: No such file or directory” it just indicates that the directory /usr/local/man/man1 doesn’t exist and you need to create it before running the install.

    Thanks for putting this together… it saved me a ton of headaches.

  34. Web Design Preston Fri, 15 Aug 2008 13:47:05 GMT

    Thanks to Julie for the URL’s. Saved me a heap of time.

  35. madrid Thu, 28 Aug 2008 22:39:51 GMT

    Thanks from me also.

Comments