My Experience and Issues Building IM on Mac OS (Tiger)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

My Experience and Issues Building IM on Mac OS (Tiger)

Post by fmw42 »

I have been an IM user for less than a year now and have until now been using the binary builds on my Mac OS 10.4 Tiger system. When Apple released OS 10.5 Leopard, IM started building binaries for it and th IM binary for Tiger no longer seems to include X11 display support. It would be nice if this were noted on the IM binary page at http://www.imagemagick.org/script/binar ... php#macosx. This situation may have changed since I last tried to use a Mac IM binary. So I have been stuck at IM 6.3.6.4 until now, as I am a novice at Unix/C and was reluctant to try to build from source.

Recently, I decided to do that as I also needed to help Sean Burke test his FFT routines that we hope eventually to build into IM. So with Sean's help and patience, we spent much of one day, trying to build a functioning IM 6.3.7.9 on my Mac Tiger system.

I want to post my experience for other Mac users. There are several issues that others might profit from my experience.


1. Mac OS Tiger install (and probably Leopard) does not automatically build a C compiler which is needed to do the IM build. So you need to download (install) Xcode Tools folder from the Mac OS installer CD or DVD. Then you need to build Xcode Tools from the XcodeTools.mpkg which is in the Utilities folder inside the Xcode Tools folder. The compiler is gcc. I built a somewhat minimal custom install using the following from the XcodeTools.mpkg: Developer Tools Software, gcc 4.0, Mac OS X SDK, BSD SDK, X11 SDK, QuickTime SDK, OpenGL SDK, Java 1.4 Tools, Developer Documentation, Developer Example Software, Mac OS X 10.3.9 SDK and Mac OS X 10.4 (Universal) SDK. However, you can just take the default install.


2. If you have been using the binary builds of IM and have modified your .profile file according to instructions, then you need to go back to the un-modified, original .profile file that comes with the Mac OS before doing any install from source.


3. IM does NOT come with all the support libraries that are needed to process several image types, including jpeg, tif and png. (Nor do these libraries come installed with the Mac Tiger software and probably not with Leopard either.) This does not seem to be noted on the Install From Source page at http://www.imagemagick.org/download/www ... .html#unix and there may be others that I am not aware that are missing.

(It sure would be nice if the folks at IM would modify this page to note what libraries are needed and where to get them so that one could build a version of IM consistent with what is distributed in binary form.)

So with Sean's help, we tracked down these libraries:

JPEG:
http://www.ijg.org/files/jpegsrc.v6b.tar.gz
PNG:
http://prdownloads.sourceforge.net/libp ... z?download
TIFF:
http://dl.maptools.org/dl/libtiff/

I recommend installing them in the above order (although it may not matter). Then install IM.

For these libraries and to install IM, the notes on the Install from Source page seems to work (except for the JPEG library). The normal install is:

cd to each library directory
./configure (for an IM Q16 default build)
make
sudo make install (rather than make install)

NOTE: Mac users need to use sudo to be able to install as root.

For the JPEG library, the last step does not work (and this is what took us most of the day to track down). It installs files in /usr/local/bin, but does not install the needed files in /usr/local/include or /usr/local/lib. To get those files properly installed, change the sudo make install to sudo make install-lib. You can find notes about this buried in the Install.doc file that is in the jpeg-6b folder.

The IM build (all steps above in total) took about 25-30 minutes for me on my Mac G4 mini. Installing each library took much shorter time.


4. The Mac OS does not automatically install X11. So one has to custom install it from the Mac OS install CD or DVD (before building IM, I suspect). However, even with it installed, it must be started before you can display from IM to X11. Then further, the normal IM display command (display yourimage) still does not work. To make it work properly, you can modify your .profile file in your home directory by adding the following line to the end of the file.

export DISPLAY=:0

I used BBEdit, Open Hidden File, to access it and modify it. My .profile file now is as follows:


##
# DELUXE-USR-LOCAL-BIN-INSERT
# (do not remove this comment)
##
echo $PATH | grep -q -s "/usr/local/bin"
if [ $? -eq 1 ] ; then
PATH=$PATH:/usr/local/bin
export PATH
fi
export DISPLAY=:0


I hope this helps others.
baloneygenerator
Posts: 3
Joined: 2016-12-08T11:37:18-07:00
Authentication code: 1151

Re: My Experience and Issues Building IM on Mac OS (Tiger)

Post by baloneygenerator »

On OS X Sierra 10.12.1.

Thank you for going to all the trouble to write this up. Unfortunately, even after I followed these suggestions, configure still couldn't find the jpeg, png nor tiff libraries, even though they were all in /usr/local/lib, the same directory as the imagemagick library files, which I also specified in the configure command line. Maybe a version problem?

So I gave up and did:
  • $ brew install imagemagick
and now the delegates are correctly listed in the convert command, and ImageMagick functions in the way I need.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: My Experience and Issues Building IM on Mac OS (Tiger)

Post by fmw42 »

You should have used viewtopic.php?f=1&t=21502&p=88202&hilit ... rts#p88202. Not sure why you found the older Tiger install notes.
Post Reply