RMagick (from source) on Snow Leopard 39
After the release of 10.5, I published an article about building RMagick from source on Leopard. I won’t rehash the why, you can read the original article for that. My clean install necessitated updating the RMagick script, so here’s what worked for me to install from source on Snow Leopard! For the impatient, here’s the download link: rmagick-build.sh
First, we start with installing wget, as it seems to be a bit more clever than curl about dealing with mirrors, etc. Then, we compile and install each prerequisite package. Finally, we install the gem.
All the links in the script worked for me, but, depending on your location, network, conditions, etc, your mileage may vary. Enjoy!
#!/bin/sh
# install wget, which is cleverer than curl
curl -O http://ftp.gnu.org/gnu/wget/wget-1.11.tar.gz
tar zxvf wget-1.11.tar.gz
cd wget-1.11
./configure --prefix=/usr/local
make
sudo make install
cd /usr/local/src
# prerequisite packages
wget http://nongnu.askapache.com/freetype/freetype-2.3.9.tar.gz
tar zxvf freetype-2.3.9.tar.gz
cd freetype-2.3.9
./configure --prefix=/usr/local
make
sudo make install
cd /usr/local/src
wget http://superb-west.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.39.tar.gz
tar zxvf libpng-1.2.39.tar.gz
cd libpng-1.2.39
./configure --prefix=/usr/local
make
sudo make install
cd /usr/local/src
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.6
./configure --enable-shared --prefix=/usr/local
make
sudo make install
cd /usr/local/src
wget ftp://ftp.remotesensing.org/libtiff/tiff-3.9.1.tar.gz
tar xzvf tiff-3.9.1.tar.gz
cd tiff-3.9.1
./configure --prefix=/usr/local
make
sudo make install
cd /usr/local/src
wget http://superb-west.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 /usr/local/src
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 /usr/local/src
wget ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/gs870/ghostscript-8.70.tar.gz
tar zxvf ghostscript-8.70.tar.gz
cd ghostscript-8.70
./configure --prefix=/usr/local
make
sudo make install
cd /usr/local/src
wget ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/gs860/ghostscript-fonts-std-8.11.tar.gz
tar zxvf ghostscript-fonts-std-8.11.tar.gz
sudo mv fonts /usr/local/share/ghostscript
# Image Magick
wget ftp://ftp.fifi.org/pub/ImageMagick/ImageMagick.tar.gz
tar xzvf ImageMagick.tar.gz
cd `ls | grep ImageMagick-`
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 --disable-openmp
make
sudo make install
cd /usr/local/src
# RMagick
sudo gem install rmagickUPDATE There is a bug with libgomp that breaks the convert utility (See comments below). the --disable-openmp configure option has been added to the script to fix this.
UPDATE 2 A new patchlevel of ImageMagick has been released that supersedes the original one referenced in this script, and the original has been removed from the server. Thanks to Sebastian for this update that will grab the latest release.
Trackbacks
Use the following link to trackback from your own site:
http://www.onrails.org/articles/trackback/4780
Thanks, Sol. I’m sure this will come in handy.
This install definitely works, but since I upgraded my system I can not longer convert pdfs to images.
$ convert my.pdf my.jpg Segmentation fault
Does happen on your install?
@Peer: hmm, yes—I get the same thing. I’ll poke around and see if we can get it sorted…
Thank you, thank you, thank you! I’ve been wrestling with various gem issues for a few hours getting everything up after the Snow Leopard upgrade and this was BY FAR the smoothest piece of the process. Kudos on a great script.
I’m up and running sans MacPorts – I used to have ImageMagick installed via ports. Is this now native to Snow Leopard?
Thank you, thank you, thank you! I’ve been wrestling with various gem issues for a few hours getting everything up after the Snow Leopard upgrade and this was BY FAR the smoothest piece of the process. Kudos on a great script.
I’m up and running sans MacPorts – I used to have ImageMagick installed via ports. Is this now native to Snow Leopard?
Sorry for the double submit, you should have a spinner :)
@Roger—No, the ImageMagick (from source, like the rest of the prerequisites) happens just before the gem install at the end of the script.
Still no go on my end Solomon. Will keep you informed if we find anything.
I tried this on my MacBook Pro with Snow Leopard installed, the script seemed to execute with no problems but then I try the following:
$ irb >> require ‘rubygems’ => true >> require ‘rmagick’ LoadError: Failed to load /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle from /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle from /usr/local/ruby-1.8.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’ from /usr/local/ruby-1.8.6/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/rmagick.rb:11 from /usr/local/ruby-1.8.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require’ from /usr/local/ruby-1.8.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require’ from (irb):4 from (null):0
tests of imagemagick from the command line work fine.
@Morgan—
Did you install ruby 1.8.6 after the Snow Leopard install, or is it there from before? I’m using the stock 1.8.7, and my bundle is at /Library/Ruby/Gems/1.8/gems/rmagick-2.11.0/lib/RMagick2.bundle. If I run the “file” command, it shows that the bundle is a universal binary with i386 and x86_64 architectures.
Hope this helps…
@Peer—
Okay, I have a fix for you. Apparently, there’s a bug with libgomp on OSX, so ImageMagick needs to be configured with the
--disable-openmpoption. I’ve updated the script (inline and attached) above.Thanks,
Solomon
Thanks for the post. One issue I had was that freetype needed make > 3.80 to work. Otherwise I got an error about make 3.79 not supporting $(value).
Also, the latest ImageMagick has been updated as well. ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.5.5-8.tar.gz
I had to download ghostscript-8.70 from here because the link above wasn’t working.
http://ghostscript.googlecode.com/files/ghostscript-8.70.tar.gz
And the fonts from here:
http://prdownloads.sourceforge.net/gs-fonts/ghostscript-fonts-std-8.11.tar.gz
Also, I had to remove the old macports libraries because I was getting an error like this:
Command output: Undefined symbols: “_FcPatternCreate”, referenced from:
I also had to install fontconfig as well to get fontconfig.h.
Also, jpeg-7 must be used or you’ll get decode errors when resizing JPEG images. The config.log error for something about _jpeg_header symbol not found in libjpeg.dyld.
wget http://www.ijg.org/files/jpegsrc.v7.tar.gz
@Solomon—
Thanks for the tip Solomon, I was using a hand compiled version of 1.8.6 (WAY faster than the one that ships with OS X) and had opted to continue using it. I built 1.8.7 and tried that and everything started working.
Also, for what it’s worth, I used MacPorts to install ImageMagick and installed the RMagick gem just by doing a ‘sudo gem install rmagick’ and everything worked. I didn’t need to use your script, but thanks!
@Solomon—
Thanks for the tip Solomon, I was using a hand compiled version of 1.8.6 (WAY faster than the one that ships with OS X) and had opted to continue using it. I built 1.8.7 and tried that and everything started working.
Also, for what it’s worth, I used MacPorts to install ImageMagick and installed the RMagick gem just by doing a ‘sudo gem install rmagick’ and everything worked. I didn’t need to use your script, but thanks!
Thx a lot :) I already used your script for 10.5 and now I’m using this one again for SL! Kudos to you Solomon! Everything worked gr8 ;)
Hi,
good job, I just had two problems:
1. It assumes the directory /usr/local/src to be present, which wasn’t on my MBP
2. On Sept 13, 2009 a new patchlevel-version of ImageMagick was put on the server (10), deleting the referenced one (5). I modified the script, so that it wgets the version linked as ImageMagick.tar.gz and after untarring chdirs into whatever directory starts with ImageMagick-
Maybe this solves the problem for some of you. (Replace Lines 78-80 with the following)
Help!
When I require ‘RMagick’, it says ‘no such file to load — RMagick2.so’.
If I require ‘RMagick2’, then the error is ‘this installation of RMagick was configured with ImageMagick 6.5.4 but ImageMagick 6.5.6-1 is in use.’
Any idea?
Help!
When I require ‘RMagick’, it says ‘no such file to load — RMagick2.so’.
If I require ‘RMagick2’, then the error is ‘this installation of RMagick was configured with ImageMagick 6.5.4 but ImageMagick 6.5.6-1 is in use.’
Any idea?
I got this error:
I have the similar error of “mike” any idea? thanks.
I´ve installed ImageMagic from src, and it seams to be ok. E.g ”$ convert /Users/martin/Desktop/TriggersInRails.pdf triggers.jpg” works as expected.
I´ve reinstalled the rmagick gem.
$ ruby script/server => Booting WEBrick => Rails 2.3.4 application starting on http://0.0.0.0:3000 /opt/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle: [BUG] Segmentation fault ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10]
Abort trap
—-—- file sais: RMagick2.bundle: Mach-O 64-bit bundle x86_64 —-—— Any ideas? Can I provide more info?
I’m getting an error during the ImageMagick make command:
ld: symbol(s) not found collect2: ld returned 1 exit status make1: * [magick/libMagickCore.la] Error 1 make: * [all] Error 2
Any ideas?
I’m getting an error during the ImageMagick make command:
ld: symbol(s) not found collect2: ld returned 1 exit status make1: * [magick/libMagickCore.la] Error 1 make: * [all] Error 2
Any ideas?
I get this error when use ImageMack. Please help me, thanks !
irb(main):002:0> require ‘rmagick’ LoadError: dlopen(/usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle, 9): no suitable image found. Did find: /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle: mach-o, but wrong architecture – /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle from /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’ from /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/rmagick.rb:11 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require’ from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require’
I get this error when use ImageMack. Please help me, thanks !
irb(main):002:0> require ‘rmagick’ LoadError: dlopen(/usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle, 9): no suitable image found. Did find: /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle: mach-o, but wrong architecture – /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle from /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’ from /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/rmagick.rb:11 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require’ from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require’
I get this error when use ImageMack. Please help me, thanks !
irb(main):002:0> require ‘rmagick’ LoadError: dlopen(/usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle, 9): no suitable image found. Did find: /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle: mach-o, but wrong architecture – /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle from /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’ from /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/rmagick.rb:11 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require’ from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require’
I get this error when use ImageMack. Please help me, thanks !
irb(main):002:0> require ‘rmagick’ LoadError: dlopen(/usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle, 9): no suitable image found. Did find: /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle: mach-o, but wrong architecture – /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle from /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’ from /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/rmagick.rb:11 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require’ from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require’
I get this error when use ImageMack. Please help me, thanks !
irb(main):002:0> require ‘rmagick’ LoadError: dlopen(/usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle, 9): no suitable image found. Did find: /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle: mach-o, but wrong architecture – /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle from /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/RMagick2.bundle from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require’ from /usr/local/lib/ruby/gems/1.8/gems/rmagick-2.11.1/lib/rmagick.rb:11 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require’ from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require’
hi, on the last step, installing the rmagick gem i have this error:
Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb checking for Ruby version >= 1.8.5... yes checking for gcc... yes checking for Magick-config... yes checking for ImageMagick version >= 6.3.5... yes checking for HDRI disabled version of ImageMagick... yes checking for stdint.h... yes checking for sys/types.h... yes checking for wand/MagickWand.h... yes checking for InitializeMagick() in -lMagickCore... no checking for InitializeMagick() in -lMagick... no Can't install RMagick 2.12.2. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information. *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby --with-MagickCorelib --without-MagickCorelib --with-Magicklib --without-Magicklib Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/rmagick-2.12.2 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-2.12.2/ext/RMagick/gem_make.outhow i can resolve the problem? i doing to install a newer version of ruby? thanks
hi, on the last step, installing the rmagick gem i have this error:
Building native extensions. This could take a while... ERROR: Error installing rmagick: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb checking for Ruby version >= 1.8.5... yes checking for gcc... yes checking for Magick-config... yes checking for ImageMagick version >= 6.3.5... yes checking for HDRI disabled version of ImageMagick... yes checking for stdint.h... yes checking for sys/types.h... yes checking for wand/MagickWand.h... yes checking for InitializeMagick() in -lMagickCore... no checking for InitializeMagick() in -lMagick... no Can't install RMagick 2.12.2. Can't find the ImageMagick library or one of the dependent libraries. Check the mkmf.log file for more detailed information. *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby --with-MagickCorelib --without-MagickCorelib --with-Magicklib --without-Magicklib Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/rmagick-2.12.2 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-2.12.2/ext/RMagick/gem_make.outhow i can resolve the problem? i doing to install a newer version of ruby? thanks
Mirco, I was getting the same error. I manually downloaded and installed the Image Magic Library. Basically ran the commands from #Image Magic down manually on my server. That seemed to fix it.
hi there I had to install ImageMagick a few different times as i had problems doing so and refered to different sources/tutes on the web for installing imagemagick on snow leopard.
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb checking for Ruby version >= 1.8.5… yes checking for gcc… yes checking for Magick-config… yes
Warning: Found more than one ImageMagick installation. This could cause problems at runtime. /usr/bin/imagemagick/bin/Magick-config reports version 6.5.5 Q16 is installed in /ImageMagick-6.5.5 /opt/local/bin/Magick-config reports version 6.5.7 Q8 is installed in /opt/local /sw/bin/Magick-config reports version 6.5.7 Q16 is installed in /sw /usr/bin/ImageMagick-6.4.8/bin/Magick-config reports version 6.4.8 Q16 is installed in /usr/local/bin/Magick-config reports version 6.5.7 Q8 is installed in /usr/local Using 6.5.5 Q16 from /ImageMagick-6.5.5.
checking for ImageMagick version >= 6.3.5… yes checking for HDRI disabled version of ImageMagick… yes checking for stdint.h… yes checking for sys/types.h… yes checking for wand/MagickWand.h… no
Can’t install RMagick 2.12.2. Can’t find MagickWand.h.Provided configuration options: —with-opt-dir —without-opt-dir —with-opt-include —without-opt-include=${opt-dir}/include —with-opt-lib —without-opt-lib=${opt-dir}/lib —with-make-prog —without-make-prog —srcdir=. —curdir —ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/rmagick-2.12.2 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/rmagick-2.12.2/ext/RMagick/gem_make.out
right, I answered my own question LOL http://rb-rmagick.darwinports.com/
Hi,
I installed ImageMagick with this script here because it seemed the most up to date one: http://github.com/masterkain/ImageMagick-sl
I get the following error in some ImageMagick commands:
Magick::ImageMagickError: Wrong JPEG library version: library is 70, caller expects 62 `’ @ jpeg.c/EmitMessage/232
Can anybody advice? What do I need to do?
Oh, and some (spinner) feedback when submitting a comment on this blog would be useful! Like others here I accidentally submitted my post twice, as there was no indication that anything happened after I pressed the submit button…
My jpeg issue is fixed now. There was an older version of the jpeg lib from Mac Ports which needed to be removed before running the Image Magick install script.