thoughts from left field
Wednesday, March 22, 2006
  Mac OS X & Rails & ImageMagick without the kruft
Recently I got one of the new Intel iMacs, and I wanted to move all my Rails development over to it. Most things went very easily, however ImageMagick doesn't seem to have a binary for Intel Macs just yet. I decided to try and install it from source. It was actually very easy to do. So if you don't feel like installing Darwin Ports/Fink just to get ImageMagick read on.

If you're not comfortable dealing with the Terminal/shell access then you may want to wait for the binary release, or go the Darwin Ports/Fink route.

Ideally you should have followed the Rails installation tutorial at Hivelogic.

Basically you need to have your path setup to look in /usr/local/bin for binaries. If you need help doing that, have a look at the aforementioned article.

Start up Terminal(usually located in the /Applications folder).

At the prompt enter:

mkdir src
cd src


Now we're ready to get and install the required software.

Note: the order here is important.

PNG


This supports PNG files. If you don't need support you can safely skip it.

curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.8-config.tar.gz
tar zxvf libpng-1.2.8-config.tar.gz
cd libpng-1.2.8-config
./configure --prefix=/usr/local
make
sudo make install

Notes:

JPEG


Pretty much everyone needs this. Unfortunately it's the most troublesome to compile and
install correctly. Follow the directions carefully. Note: The single quotes in the fourth line
are backquotes, not regular quotes. (see the tilda key)

curl -O http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
ln -s `which glibtool` ./libtool
export MACOSX_DEPLOYMENT_TARGET=10.4
./configure --enable-shared --prefix=/usr/local
make
sudo make install

TIFF


Everyone needs this as well.

curl -O ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.8.2.tar.gz
tar zxvf tiff-3.8.2.tar.gz
cd tiff-3.8.2
./configure --prefix=/usr/local
make
sudo make install

ImageMagick


The big tamale! The [VERSION] tag below denotes the version of ImageMagick you actually got. ImageMagick.tar.gz is a link to the latest version of ImageMagick, so the version will change as they do new releases.

curl -O ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar zxvf ImageMagick.tar.gz
cd ImageMagick-[VERSION]
./configure --without-perl
make
sudo make install

Updated to use the latest version via the linked file.

RMagick


One more step, add the ruby bindings to ImageMagick. You may get some errors during the Rdoc
install phase, you can safely ignore them.

sudo gem install rmagick


Woot! You're done. Have a beverage, and get down to work.
 
Comments:
This works great! Thank you.
 
Many thanks for such a great tutorial. I've followed it successfully several times. Now, where did I leave my beverage...
 
Just some notes:

In the steps for JPEG there's a period missing, it should be:

./configure --enable-shared --prefix=/usr/local

and when I did this the version of tiff was up to 3.8.2. Replace all of the 3.8.1 in the tiff instructions with 3.8.2 you should be golden.

Finally, libpng wasn't available from simplesystems the day I did it. I picked up the latest from

http://www.libpng.org/pub/png/libpng.html
 
Thanks Dave, I've updated the post to correct the missing period, and changed tiff to 3.8.2.
 
libpng is no longer available on the link posted. Get it from one of the sourceforge downloads linked from the official home page http://www.libpng.org/pub/png/libpng.html
 
Don't get me wrong, I love the tutorials, and I am glad this is all being well documented. But between Rails and ImageMagick, DarwinPorts is the way to go. I have installed everything through it, and it is just works so well.
 
ImageMagick is up to 6.4.7-0. Trying the install now, hopefully all will be ok
 
Your curl statement for ImageMagick does not work they are on 6.2.7-0. Other than that great tutorial. It seems all the libraries are being updated right after you change their listings. :)
 
Hey Adam,

I totally agree that Darwin Ports and Fink are excellent ways to get all this running. For many people that is a much better route to take.

I however like just having the software I need without adding an entirely new management framework and a boat load of other bloat. The ImageMagick that comes with Darwin Ports/Fink is compiled with pretty much every option turned on. I don't really need 80% of the features that IM offers, so it just seemed easier to roll my own.
 
I got some issue with imagemagick and libpng 1.2.10, back to 1.2.8 everything was fine...
thanks!
 
THANK YOU good man!

I jumped onto the intel bandwagon without really thinking it over (the filthy alure of PC game whores). And then: Wheres imagemagick for intel macs???!? Since I am not into the "sudo" midst of things, I was done for.

Thanks!!!!
 
the current version of libpng is 2.1.10. it no longer ships with the configure option. and didn't see a valid makefile in the script dir which worked with osx intel. got the 2.1.8 from sourceforge
 
Thanks a ton. This worked great on the intel mac. I had no problems with the libpng-1.2.10. I have XCode 2.3 that just shipped - maybe that fixes the problem some have reported.
 
Something's still missing. I tried going through this (in the console):

http://rmagick.rubyforge.org/web2/web2.html

and when I got to this statement:

gc.annotate(background, 0, 0, 70, HEIGHT, "RMAGICK")

I get errors:

sh: line 1: gs: command not found
sh: line 1: gs: command not found
RMagick: no decode delegate for this image format `/var/tmp/magick-Cg1JykLQ'.
RMagick: Postscript delegate failed `/var/tmp/magick-Cg1JykLQ'.
sh: line 1: gs: command not found
sh: line 1: gs: command not found
RMagick: no decode delegate for this image format `/var/tmp/magick-zCiPCyGp'.
RMagick: Postscript delegate failed `/var/tmp/magick-zCiPCyGp'.
=> (no primitives defined)


Huh?!?

I also get errors when trying to do a gem update.

Anyone?
 
This is a great tutorial ... saved me a lot of hassle and worked like a treat!

The only teeny weeny suggestion I'd make is adding in the command cd .. at the end of each bit you install because if you follow your instructions literally you get end up with a 'unique' directory structure!
 
Unfortunately

http://www.ijg.org

doesn't seem to exist now
 
great it works perfect
system here is G4 Double proc 2x1.4 GHz with 1GB RAM, OS 10.4.8

regards Frank
 
Anonymous, if you get this error,
"sh: line 1: gs: command not found" it simply means that you do not have ghostscript installed on your machine or the executable location is not in your path. A simple way to get gs is by installing fink and installing the gs package.
 
As others have said... great tutorial.

My addition:

When running the jpeg configure script I got an error:
ltconfig: cannot guess host type; you must specify one

I was running this on an intel Mac mini by the way. The command 'uname -m' shows what you are looking for... in my case 'i386' is the host type.

I opened up the 'configure' script, and found the line where it runs ltconfig and added 'i386' to the end of the line (no quotes of course).

Thanks again,
Malcolm
 
Hello,

Great tutorial. I've used it in the past without problems. But I'm getting some problems now on a fresh machine...

This is from the gem install step:
RMagick: FreeTypeLibraryIsNotAvailable `(null)'.
RMagick: no decode delegate for this image format `/var/tmp/magick-ea4gs8oj'.
RMagick: Postscript delegate failed `/var/tmp/magick-ea4gs8oj'.

And later on, I see that an error that not enough tests passed.

Any thoughts?

Thanks,

Matt
 
This comment has been removed by the author.
 
Thank you for this clean step by step installation guide.

I am on an Intel Mac OS X 10.4. All the steps went well so far. I am psyched to try it.

[me@my-machine] irb
>> require 'rmagick'
=> true

GREAT!
 
For the record, this works on Leopard.
 
Let me add my thank you to the rest. It worked perfectly. Also, thanks to Malcolm for his comment on solving the issue with the jpeg configure script.
 
For those with problems like gs not found,
change the pathes in
/usr/local/lib/ImageMagick-*/config/delegates.xml
for the gs delegate entries.
Take care gs will (if installed) most likely be in /usr/local/bin and that path might or might not be in your path hence the trouble.
You can also configure ImageMagick with --frozen-pathes then paths for found delegates will be absolute...


take care
paradoxix
 
I liked this blog because is easy understandable and very useful. for me Os X is the best software that i proved before. I really like this kind of technology because isn´t complex to use.
buy viagra
 
Erectile Dysfunction FAQ's

Impotence, or penile erectile dysfunction, in men is not as rare as one would think it is.
In fact, one out of ten men around the world is affected by this condition. It is not exclusive to old men either. Impotence is caused not just by physical factors,
but mental factors as well.
Exercising on a regular basis and eating healthy food will increase your ability to sustain prolonged physical effort and we all know that sex is effort.
Smoking, frequently drinking large quantities of alcohol, taking recreational drugs and lack of exercising will sap your stamina and also slow down the flow of blood.
Penis exercises can be used for maintaining fitness, preventing or controlling premature ejaculation and increasing the length and girth of the penis.
by penis enlargement pills you can overcome these problems and not only that you can also enlarge, extend also to strengthen your penis and premature ejaculation will not exist anymore for you.
visit http://www.factspenisenlargement.com for more info.
 
Afterdominical costa rica tours spending most of my computing life exclusively on Windows, I’ve made the switch to a Mac. Why now? Over the years, I’ve become quite adept and comfortable in Windows. I’ve focused much of my career around Windows technologies. So why the switch now, especially with Microsoft’s Vista launching?
http://www.dominicalcostaricatours.com

 
Vimax is reliable stuff to accomplish your sexual dysfunction. It has been proven by many men to augment virility and genital.
 
Your blog is definitely worth a read if anyone comes across it. Im lucky I did because now Ive got a whole new view of this.
 
The positive comments and do well wishes are very motivational and greatly appreciated.
 
The positive comments and do well wishes are very motivational and greatly appreciated.
 
Your blog is definitely worth read.Thanks for posting!
 
Really i appreciate the effort you made to share the knowledge.The topic here i found was really effective to the topic which i was researching for a long time
 
This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.
 
Thanks for your post, I like this post very much.
 
Your blog is definitely worth a read if anyone comes across it. Im lucky I did because now Ive got a whole new view of this.
 
I would like to think you for sharing your thoughts and time into your comments! Thumbs Up !
 
I liked this blog because is easy understandable and very useful. for me Os X is the best software that i proved before. I really like this kind of technology because isn´t complex to use. Website Hosting Companies
 
This post is great! Do you know how to build the ImageMagick library for i386 target?
 
This blog is very nice i like it this is paragraph is so nice its very informative.

Ready-Made Communications and Media Logo
 
very nice post. thanksss . please continue.
 
Truth be told, what you wrote is something that was a long time coming.
 
What was presented in this article has forced me to reconsider and redefine previously held viewpoints. This can only be a good thing. Kimberly@reverse phone lookup
 
I just added this post as a favorite.
because it is very interesting and provide insight to readers ..
thanks

Penis Enlargement Pills
Vimax Pills
Vimax Extender
 
Sometimes you build the walls of the mind and not to stay away from the crowd, but to see clear who CARES to break it.taxis in w2 | minicab to airport | airport drop w2
 
If you don't like something, change it with the action; If you can't change it, change your attitude; Anyway, don't complain.cabs in w2 | cab w2 | w2 taxis
 
thanks for sharing,good article.I like it.mirza maqbool | Maqbool mirza
 
Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!
SEO Company In Lahore
 
Linux web hosting application has more web designed features comprised into it, and also much secure and more efficient than windows web hosting. The Linux Web Hosting also gathers the languages such as php, perl to provide the services to those languages and works more efficiently and accurately to team up with the building blocks of services provided by the companies.
Linux Web Hosting
 
Post a Comment



<< Home

ARCHIVES
March 2006 /


Powered by Blogger