My Experience and Issues Building IM on Mac OS (Tiger)
Posted: 2008-01-14T19:30:06-07:00
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.
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.