Are PackageMaker installations with preinstall scripts broken on Snow Leopard?

Stu Thompson picture Stu Thompson · Sep 14, 2009 · Viewed 8.1k times · Source

Everything worked on 10.5, but now my PackageMaker installation project is broken. I've been fighting a problem for a few days now, and either

  • Snow Leopard (OS X 10.6.1) has broken PackageMaker installations
  • I am lacking a very, very basic tidbit of knowledge

To narrow down the problem, I've gotten to this point:

  1. Create a new PackageMaker installation
  2. Have it install a jpeg image into my home directoy
  3. Define a preinstall script that does nothing
    #!/bin.sh
    exit 0

Run the above...and watch it fail with the below error message like clock work

Sep 14 15:09:45 manoa installd[5620]: PackageKit: ----- Begin install -----
Sep 14 15:09:45 manoa installd[5620]: PackageKit: request=PKInstallRequest <1 packages, destination=/>
Sep 14 15:09:45 manoa installd[5620]: PackageKit: packages=(\n    "PKLeopardPackage <file://localhost/Users/stu/Desktop/asdf.pkg>"\n)
Sep 14 15:09:46 manoa installd[5620]: PackageKit: Extracting /Users/stu/Desktop/asdf.pkg (destination=/var/folders/Hb/HbXJFyEpFaupt5QyLN-pTk+++TI/-Tmp-/PKInstallSandbox-tmp/Root/~, uid=501)
Sep 14 15:09:46 manoa installd[5620]: PackageKit: Executing script "./preinstall" in /private/tmp/PKInstallSandbox.cmlS2H/Scripts/test.test.5year_header.pkg.PFrHNB
Sep 14 15:09:46 manoa installd[5620]: PackageKit: *** launch path not accessible
Sep 14 15:09:46 manoa installd[5620]: PackageKit: Install Failed: PKG: pre-install scripts for "test.test.5year_header.pkg"\nError Domain=PKInstallErrorDomain Code=112 UserInfo=0x100149430 "An error occurred while running scripts from the package “asdf”." {\n    NSFilePath = "./preinstall";\n    NSLocalizedDescription = "An error occurred while running scripts from the package \U201casdf\U201d.";\n    NSURL = "file://localhost/Users/stu/Desktop/asdf.pkg";\n    PKInstallPackageIdentifier = "test.test.5year_header.pkg";\n}
Sep 14 15:09:46 manoa Installer[5614]: install:didFailWithError:Error Domain=PKInstallErrorDomain Code=112 UserInfo=0x1195917c0 "An error occurred while running scripts from the package “asdf”."
Sep 14 15:09:46 manoa Installer[5614]: Install failed: The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.
Sep 14 15:09:47 manoa Installer[5614]: IFDInstallController 144040 state = 7
Sep 14 15:09:47 manoa Installer[5614]: Displaying 'Install Failed' UI.
Sep 14 15:09:47 manoa Installer[5614]: 'Install Failed' UI displayed message:'The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.'.

There is no file in /private/tmp/PKInstallSandbox.cmlS2H/Scripts/test.test.5year_header.pkg.PFrHNB/, which makes me think the problem is with PackageMaker, and not me. But I'm new to the world of OS X software installation, so doubts remain.

So, the question: Is PackageMaker with a preinstall script broken on OS X 10.6? Or is there some requirement regarding preinstall scripts that I do not understand?

Answer

yairchu picture yairchu · Nov 13, 2013

I had the same problem and setting the executable permissions for the scripts solved it for me!

pkgutil --expand my.pkg my 
chmod +x my/inner.pkg/Scripts/preinstall 
pkgutil --flatten my my-fixed.pkg 

Found this solution in this thread at golang-nuts groups