Question

I am building a simple package on OS X using pkgbuild that consists of a folder of stuff and the pre/postinstall scripts. When I try to execute the resulting package, the installer fails with the following message in the log:

Nov 1 13:28:11 localhost installd[631]: ./preinstall: 2013-11-01 13:28:11.074 installd[637:203] * NSTask: Task create for path '/tmp/PKInstallSandbox.P6mPx2/Scripts/com.xyz.utility.pkg.TWwYct/preinstall' failed: 22, "Invalid argument". Terminating temporary process.

The installer is running as root. The problem does not appear to be the contents of the scripts since they fail even after I cut them down to a simple "exit 0" with the interpreter declaration. This issues occurs on 10.8.2 and 10.8.4.

The issue looks like an exception that is thrown from within an NSTask object, but all I get is this 22 error code and the "Invalid argument" message. I think this message might refer to an NSInvalidArgumentException. I made sure the scripts are indeed being placed at the temporary location listed in the error message and they are there with the correct permissions.

Any ideas as to what causes this type of error message? I found several references to this error when I did some searching but there didn't seem to be a unifying cause or solution.

Was it helpful?

Solution

Add #!/bin/sh header into the preinstall script.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top