Search code examples
macosinstallationpackagemaker

How do I get PackageMaker to create the payload's containing folder with correct permissions


I'm creating an installer using PackageMaker v3.0.4.

One of the payloads is a library, which I'm installing to the location /usr/local/lib/

The permissions of the library itself are set up thus:

-rwxr-xr-x  1 root    admin  992180  1 Jun  2009 libxxxx.0.dylib

This works correctly, so long as the lib directory already exists when the installer is run. However, if the lib directory doesn't exist when the installer runs, then it is created with the following permissions:

drwx------   3 username  wheel  102 30 Jun 10:44 lib

And subsequently, the application cannot open the lib when runs the code:

void *theDylib = dlopen("/usr/local/lib/libxxxx.0.dylib",RTLD_NOW);

How can I get PackageMaker to install the directory with the correct permissions?


Solution

  • N.B. Kevin Green's answer looks like a better solution, but this is what I ended up doing.

    If you set the payload to be a single directory containing just the library instead of the library itself, and tick Include root in package then the Installer will create the directory with the correct permissions if it doesn't already exist.