Help getting RMagick working

I've tried everything to get RMagick working on my iBook. I'm running
OS X 10.4.1, rather than tell you everything I've tried that doesn't
work, I was wondering if someone had a working copy on their Mac, if
they could just walk me through the steps they took to make it work on
their machine? The error I'm getting is:

/usr/bin/ruby -I /Users/pj/Desktop/RMagick-1.8.1/lib -I
/Users/pj/Desktop/RMagick-1.8.1/ext/RMagick Adispatch.rb (example 1 of
178)
Adispatch.rb:4:in `read': no decode delegate for this image format
`images/Flower_Hat.jpg': (Magick::ImageMagickError)
from Adispatch.rb:4
post-setup.rb: Adispatch.rb example returned error code 256

pjhyett@gmail.com wrote:

I've tried everything to get RMagick working on my iBook. I'm running
OS X 10.4.1, rather than tell you everything I've tried that doesn't
work, I was wondering if someone had a working copy on their Mac, if
they could just walk me through the steps they took to make it work on
their machine? The error I'm getting is:

/usr/bin/ruby -I /Users/pj/Desktop/RMagick-1.8.1/lib -I
/Users/pj/Desktop/RMagick-1.8.1/ext/RMagick Adispatch.rb (example 1 of
178)
Adispatch.rb:4:in `read': no decode delegate for this image format
`images/Flower_Hat.jpg': (Magick::ImageMagickError)
from Adispatch.rb:4
post-setup.rb: Adispatch.rb example returned error code 256

Sorry you're having trouble.

There's a file in your RMagick install directory called README-Mac-OSX.txt. This is an description for installing ImageMagick or GraphicsMagick and RMagick on Tiger.

If you still have trouble with the install email me at rmagick@rubyforge.org or start a thread in RMagick's Help Forum on RubyForge.

I went through the textfile and was able to get RMagick to make
thumbnails again! The only problem is it fails a bunch of the post
install tests.

They all pretty much look like this:
post-setup.rb: setting up documentation...
/usr/bin/ruby -I /Users/pj/Desktop/RMagick-1.8.1/lib -I
/Users/pj/Desktop/RMagick-1.8.1/ext/RMagick InitialCoords.rb
/Users/pj/Desktop/RMagick-1.8.1/lib/rvg/misc.rb:320:in `render':
undefined method `width' for nil:NilClass (NoMethodError)
        from /Users/pj/Desktop/RMagick-1.8.1/lib/rvg/misc.rb:688:in
`text'
        from /Users/pj/Desktop/RMagick-1.8.1/lib/rvg/text.rb:64:in
`add_primitives'
        from /Users/pj/Desktop/RMagick-1.8.1/lib/rvg/container.rb:71:in
`add_primitives'
        from /Users/pj/Desktop/RMagick-1.8.1/lib/rvg/container.rb:71:in
`each'
        from /Users/pj/Desktop/RMagick-1.8.1/lib/rvg/container.rb:71:in
`add_primitives'
        from /Users/pj/Desktop/RMagick-1.8.1/lib/rvg/rvg.rb:262:in
`add_outermost_primitives'
        from /Users/pj/Desktop/RMagick-1.8.1/lib/rvg/rvg.rb:262:in
`each'
        from /Users/pj/Desktop/RMagick-1.8.1/lib/rvg/rvg.rb:262:in
`add_outermost_primitives'
        from /Users/pj/Desktop/RMagick-1.8.1/lib/rvg/rvg.rb:235:in
`draw'
        from InitialCoords.rb:23
post-setup.rb: InitialCoords.rb example returned error code 256

pjhyett@gmail.com wrote:

I went through the textfile and was able to get RMagick to make
thumbnails again! The only problem is it fails a bunch of the post
install tests.

They all pretty much look like this:
post-setup.rb: setting up documentation...
/usr/bin/ruby -I /Users/pj/Desktop/RMagick-1.8.1/lib -I
/Users/pj/Desktop/RMagick-1.8.1/ext/RMagick InitialCoords.rb
/Users/pj/Desktop/RMagick-1.8.1/lib/rvg/misc.rb:320:in `render':
undefined method `width' for nil:NilClass (NoMethodError)
        from /Users/pj/Desktop/RMagick-1.8.1/lib/rvg/misc.rb:688:in
`text'

Looks like a problem with the font configuration. Try this:

Go to /opt/local/lib/ImageMagick-6.x.y/config, where 6.x.y is the actual version number of ImageMagick you installed.

Open the file type.xml in a text editor. It should look like this:

<?xml version="1.0"?>
<typemap>
    <include file="type-ghostscript.xml" />
</typemap>

Then edit the type-ghostscript.xml file in the same directory. You should see a lot of entries that look like this:

   <type
     name="AvantGarde-Book"
     fullname="AvantGarde Book"
     family="AvantGarde"
     foundry="URW"
     weight="400"
     style="normal"
     stretch="normal"
     format="type1"
     metrics="/opt/local/share/ghostscript/fonts/a010013l.afm"
     glyphs="/opt/local/share/ghostscript/fonts/a010013l.pfb"
     />

Make sure that the directory shown in the "metrics" attribute exists on your system and that it actually contains the specified files.

The /opt/local/share/directory/ghostscript/fonts directory is created when you install X11. You have to specify this directory with the --with-gs-font-dir= option when you configure ImageMagick.

If the metrics and glyphs attributes have the wrong directory then you can either re-build and re-install ImageMagick, specifying the correct directory, or you can just edit the type-ghostscript.xml file yourself (if you're comfortable with that).

If you don't have the fonts on your system at all then you need to install X11.

If the fonts are present and the type-ghostscript.xml file has the right directory then something else is wrong.

Let me know either way. Good luck!

Background: ImageMagick/GraphicsMagick doesn't search your system for fonts during the installation process. It just assumes that you have a predefined (common) set of fonts. All you can do is tell it where these fonts are at. If you don't have those fonts then you get errors at run-time.

Thanks a bunch Tim! Everything is a-okay now. BTW, the X11 download
link in the MacOS readme is broken. I found the source at the
developers site and just compiled it the old fashioned way.

-PJ

pjhyett@gmail.com wrote:

Thanks a bunch Tim! Everything is a-okay now. BTW, the X11 download
link in the MacOS readme is broken. I found the source at the
developers site and just compiled it the old fashioned way.

-PJ

Thanks for pointing this out, PJ. I see from this page http://developer.apple.com/darwin/runningX11.html that X11 is available on the Tiger install disk. I'll update the README.

Glad to know that everything is up and running for you now.