Installing RMagick on Leopard (without MacPorts or Fink) 42
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:
#!/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
you can replace wget with “curl -O” since wget ins’t installed by default on Leopard.
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.
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….
@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!
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.
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.
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.
Nice work.
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!
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!
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?
@Tim: you need to require ‘RMagick’, notice the capitalization
@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>
awesome. nice work. took like 20 minutes on my 2GHz macbook, but seems to have worked…
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
SetupRailsonLeopard. I just completed my Rails setup, thanks Tim you rock, this is the quick rundown on it.
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 !
Thanks a lot!! Worked a treat apart from the URL issues which were commented about above.
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!
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.
thanks so much, worked like a champ.
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
@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
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/
@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.
there was a problem with both ghostscript ftps, so I substituted:
wget http://ufpr.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.60.tar.gz
and
wget http://ufpr.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-fonts-std-8.11.tar.gz
Thank you very much! Everything worked! :)
I think it’s sudo gem install rmagick not RMagick. Otherwise everything worked pretty well with the urls from Julie.
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.
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.
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.
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:
Thanks for putting this together… it saved me a ton of headaches.
Thanks to Julie for the URL’s. Saved me a heap of time.
Thanks from me also.