Page 1 of 1

Help with OS-X (tiger) installation

Posted: 2008-03-13T17:36:41-07:00
by madsamurai
I installed on os-x tiger using the binary release package.

ImageMagick is installed in $HOME/local to match my web server (didn't really have a choice where to install on my webserver, as I don't have install access to /usr/local, and I want my local dev webserver to use the same path to IM so I don't have to change code when I upload to production server).

Now I can't figure out how to tell the system permanently where to find the bin and lib files. If I am in terminal I can do:
export MAGICK_HOME="$HOME/local"
export PATH="$MAGICK_HOME/bin:$PATH"
export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib"

and I can execute the ImageMagick commands from the terminal successfully, but if I quit the terminal those settings go away when I open a new terminal and I have to do those export commands again before it will work.
But even if I do run all those export statements, it seems to apply only to my terminal session, and when I try to access ImageMagick commands via php from my local web server, it won't work.

note that I had the same issue when I installed macports... that's why I installed IM with the binary. The macports doc mentions a .profile file, which doesn't exist in my home folder as they say it should (yes, I can see hidden files).

Please help. I've been wasting days trying to get this all set up, and am getting behind on my core programming schedule. Thanks in advance.

Re: Help with OS-X (tiger) installation

Posted: 2008-03-14T13:25:50-07:00
by madsamurai
well, I removed the binary install and got the macports installer to work, so my imagemagick files are now installed in /opt/local.

I added the /opt/local/bin and /opt/local/sbin to the PATH in /etc/profile, as well as the lines 'export DYLD_LIBRARY_PATH=/opt/local/lib' and 'export MAGICK_HOME=/opt/local', and that solved the problem of having to type those exports every time I open a new shell...

But now when I try to run convert, I get this error:
dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /opt/local/lib/libjpeg.62.dylib


Thing is, libjpeg.62.dylib is exactly where the error says it was expected, in /opt/local/lib. Can't see why it's not working... my only idea is that the libjpeg.62.dylib is actually an alias that points to libjpeg62.0.0.dylib in the same folder, but that doesn't seem like it should matter.

Hope somebody can provide some insight...
------- update...
Here's maybe a clue for those who understand this stuff... when I try to execute the convert command from php (like exec('/opt/local/lib/config ...'); ) running on MAMP Pro, the error is:
dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /Applications/MAMP/Library/lib/libjpeg.62.dylib

--------- update...
I found a post about a similar error, and the answer was to not define DYLD_LIBRARY_PATH in the environment. So I took that out, and now convert works properly from the command line. Unfortunately I still have the issue from MAMP... looking in /Applications... as above. Maybe an apache/httpd.conf setting?

----------finally...
Found the answer here: http://www.brybot.ca/archives/113-Getti ... -OS-X.html

MAMP sets the PATH and DYLD_LIBRARY_PATH internally, in MAMP/Library/bin/envvars... problem solved.

Hope this helps somebody...

Re: Help with OS-X (tiger) installation

Posted: 2008-03-28T19:44:25-07:00
by fmw42
When I was installing the binaries from IM on my Mac OSX Tiger, I had to modify my .profile file in my home directory. You can find it using the terminal by going to your home directory and typing

ls -al

That should make a list that show .profile

To see it type

cat .profile

I then modified it (using BBEdit), but you can you can use any text editor that will let you see hidden files such as those that start with a period.

Mine after editing looked as follows for IM 6.3.6

##
# 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 MAGICK_HOME="/Users/fred/Applications/ImageMagick-6.3.6"
export PATH="${PATH}:$MAGICK_HOME/bin"
export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}:$MAGICK_HOME/lib"
export DISPLAY=:0


The files in red above are what I had to add to the default .profile. If you do this, be sure to make a backup copy of the original .profile for safety if you have to go back.

Later I started to install the source code manually. The issue with that, whether you do it using MacPorts, Fink or manually is that you need to build all sorts of delegate libraries before you build IM.

See

http://www.imagemagick.org/script/advan ... lation.php

and

http://www.imagemagick.org/download/delegates/


Hope this helps. I struggled for a long time on this as well.

I posted the following some time ago in the IM forums about installing manually from source. But here it is again.


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 the IM binary for Tiger does no longer seems to include X11 display support (which is not 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.

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/

(At the time I orginally wrote this I did not know about http://www.imagemagick.org/download/delegates/ So you can find most of the needed delegate libraries here rather than having to track them down as above.)

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. 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.