OSX Leopard and PATH issue

Merton Campbell Crockett m.c.crockett at roadrunner.com
Sun May 11 16:17:58 PDT 2008


On 11 May 2008, at 08:25:47, Tony Crockford wrote:

> Background:
>
> I have a PHP script that uses exec() to run ImageMagick to make jpg  
> thumbnails from PDF's (needs ghostscript too)
>
> it worked more or less out of the box on Tiger - I installed Mac  
> Ports from the .pkg installer and IIRC that was it.
>
> on Leopard (using the native install of Apache) I have added /opt/ 
> local/bin to my $PATH and while ImageMagick works fine like that it  
> couldn't find Ghostscript until I edited IM's delegate.xml file to  
> include the full path to gs
>
> I suppose my question is, does anyone know why that might be, and  
> how I could tell Apache to use my $PATH variable?

In Mac OS X 10.5.x, Apple diddled with how PATH and MANPATH are  
generated.

If you want all users on your system to have /opt/local/bin and /opt/ 
local/sbin in their PATH.  Create the following file, /private/etc/ 
paths.d/Macports.  The file should contain each path element on a  
separate line.

You can do the same for /opt/local/share/man for man pages, this time  
create the following file, /private/etc/manpaths.d/Macports with each  
element on a separate line.

When you reboot, Apache will see the new paths.

There is a catch with this method.  Apple has an application that  
ensures that /usr/bin and /usr/sbin will precede all other {s}bin  
directories in the path.  Actually, it may be a shell script.   
Regardless, I can't recall its name at the moment.

Merton Campbell Crockett
m.c.crockett at roadrunner.com





More information about the macports-users mailing list