Hi, we have an app that has been in development since Catalina and ever since Sonoma came out we noticed that when executing our pkg installer the application is installed correctly but the postinstall script is not executed.
The weird thing is that if I run the pkg for the first time the postinstall does not execute BUT if I run it again then it DOES!!
Looking through the logs I found these ones that confirm the execution of the script is being blocked. We haven't changed anything in the way we build the installer so I'm not quite sure how to fix this.
2024-04-25 16:29:51.570662-0300 0x1c62 Error 0x0 308 0 syspolicyd: [com.apple.syspolicy.exec:default] Unable (errno: 2) to read file at <private> for pid: 784 process path: <private> library path: (null)
2024-04-25 16:29:51.570662-0300 0x1c62 Error 0x0 308 0 syspolicyd: [com.apple.syspolicy.exec:default] Terminating process due to Malware rejection: 784, <private>
2024-04-25 16:29:51.570679-0300 0x1d13 Default 0x0 0 0 kernel: (AppleSystemPolicy) ASP: Sleep interrupted, signal 0x100
2024-04-25 16:29:51.570682-0300 0x1d13 Default 0x0 0 0 kernel: (AppleSystemPolicy) ASP: Security policy would not allow process: 784, /private/tmp/PKInstallSandbox.m5Av3O/Scripts/com.mycompany.myapp.pkg.BSOjtt/postinstall
The app as well as the installer are both signed, notarized and stapled. Here you can see the script which just simply executes the app.
#!/bin/bash
echo "Running postinstall"
/Applications/myapp.app/Contents/MacOS/myapp --load-system-extension &
exit 0
Any help would be much appreciated. Thanks!
After many tests I finally found a solution. Apparently the &
at the end of the command is whats causing the issue in Sonoma.
So I had to replace this command:
/Applications/myapp.app/Contents/MacOS/myapp --load-system-extension &
With this one:
/usr/bin/open /Applications/myapp.app --args --load-system-extension
And now it works perfectly! Im still curious about those better ways to activate an extension.