So I’m trying to build an installer for a .NET project. I’ve published the project in Jetbrains Rider and this is my file structure now:
NewPoseidonRoot
├── Poseidon
│ ├── Contents
│ │ ├── Info.plist
│ │ ├── MacOS
│ │ │ └── Poseidon.svc
│ │ ├── Resources
│ │ └── [all other files needed by Poseidon.svc]
├── scripts
│ ├── preinstall.sh
│ └── postinstall.sh
└── component.plist
Poseidon.svc is a service that I’m targeting for the install, and all of its supporting files are in Resources. The issue I’m seeing is that the scripts don’t execute, and in /var/log/install.log, I see the following output:
2024-05-14 12:42:37-04 MacBook-Pro-4 Installer[74100]: PackageKit: Enqueuing install with framework-specified quality of service (utility)
2024-05-14 12:42:37-04 MacBook-Pro-4 installd[73903]: PackageKit: Set reponsibility for install to 74100
2024-05-14 12:42:37-04 MacBook-Pro-4 installd[73903]: PackageKit: Hosted team responsibility for install set to team:(R5Z254TK93)
2024-05-14 12:42:37-04 MacBook-Pro-4 installd[73903]: PackageKit: ----- Begin install -----
2024-05-14 12:42:37-04 MacBook-Pro-4 installd[73903]: PackageKit: request=PKInstallRequest <1 packages, destination=/>
2024-05-14 12:42:37-04 MacBook-Pro-4 installd[73903]: PackageKit: packages=(
"PKLeopardPackage <id=com.netarx.poseidon, version=1.0.0, url=file://localhost/Users/stevep/Documents/NewPoseidon/Poseidon.pkg>"
)
2024-05-14 12:42:38-04 MacBook-Pro-4 installd[73903]: PackageKit: Will do receipt-based obsoleting for package identifier com.netarx.poseidon (prefix path=Library/Application Support/Netarx)
2024-05-14 12:42:38-04 MacBook-Pro-4 installd[73903]: PackageKit: Extracting file://localhost/Users/stevep/Documents/NewPoseidon/Poseidon.pkg (destination=/Library/InstallerSandboxes/.PKInstallSandboxManager/86FE3A0F-3737-4311-937D-639C117886D7.activeSandbox/Root/Library/Application Support/Netarx, uid=0)
2024-05-14 12:42:39-04 MacBook-Pro-4 installd[73903]: PackageKit: prevent user idle system sleep
2024-05-14 12:42:39-04 MacBook-Pro-4 installd[73903]: PackageKit: suspending backupd
2024-05-14 12:42:39-04 MacBook-Pro-4 installd[73903]: PackageKit (package_script_service): Preparing to execute script "./scripts/preinstall.sh" in /private/tmp/PKInstallSandbox.IQhJX0/Scripts/com.netarx.poseidon.nEaGyN
2024-05-14 12:42:39-04 MacBook-Pro-4 package_script_service[73940]: PackageKit: Preparing to execute script "preinstall.sh" in /private/tmp/PKInstallSandbox.IQhJX0/Scripts/com.netarx.poseidon.nEaGyN/scripts
2024-05-14 12:42:39-04 MacBook-Pro-4 package_script_service[73940]: Set responsibility to pid: 74100, responsible_path: /System/Library/CoreServices/Installer.app/Contents/MacOS/Installer
2024-05-14 12:42:39-04 MacBook-Pro-4 package_script_service[73940]: Hosted team responsibility for script set to team:(R5Z254TK93)
2024-05-14 12:42:39-04 MacBook-Pro-4 package_script_service[73940]: PackageKit: Executing script "preinstall.sh" in /private/tmp/PKInstallSandbox.IQhJX0/Scripts/com.netarx.poseidon.nEaGyN/scripts
2024-05-14 12:42:39-04 MacBook-Pro-4 package_script_service[73940]: PackageKit: *** launch path not accessible
2024-05-14 12:42:39-04 MacBook-Pro-4 package_script_service[73940]: PackageKit: Failed task has no attributes: Error Domain=NSCocoaErrorDomain Code=260 "The file “preinstall.sh” couldn’t be opened because there is no such file." UserInfo={NSFilePath=/private/tmp/PKInstallSandbox.IQhJX0/Scripts/com.netarx.poseidon.nEaGyN/scripts/preinstall.sh, NSUnderlyingError=0x14c307510 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
2024-05-14 12:42:39-04 MacBook-Pro-4 package_script_service[73940]: PackageKit: Hosted team responsible for script has been cleared.
2024-05-14 12:42:39-04 MacBook-Pro-4 package_script_service[73940]: Responsibility set back to self.
2024-05-14 12:42:39-04 MacBook-Pro-4 install_monitor[74117]: Temporarily excluding: /AppleInternal, /Applications, /Library, /System, /bin, /private, /sbin, /usr
2024-05-14 12:42:39-04 MacBook-Pro-4 install_monitor[74117]: Re-included: /AppleInternal, /Applications, /Library, /System, /bin, /private, /sbin, /usr
2024-05-14 12:42:39-04 MacBook-Pro-4 installd[73903]: PackageKit: releasing backupd
2024-05-14 12:42:39-04 MacBook-Pro-4 installd[73903]: PackageKit: allow user idle system sleep
2024-05-14 12:42:39-04 MacBook-Pro-4 installd[73903]: PackageKit: Install Failed: Error Domain=PKInstallErrorDomain Code=112 "An error occurred while running scripts from the package “Poseidon.pkg”." UserInfo={NSFilePath=./scripts/preinstall.sh, NSURL=file://localhost/Users/stevep/Documents/NewPoseidon/Poseidon.pkg, PKInstallPackageIdentifier=com.netarx.poseidon, NSLocalizedDescription=An error occurred while running scripts from the package “Poseidon.pkg”.} {
NSFilePath = "./scripts/preinstall.sh";
NSLocalizedDescription = "An error occurred while running scripts from the package U201cPoseidon.pkgU201d.";
NSURL = "file://localhost/Users/stevep/Documents/NewPoseidon/Poseidon.pkg";
PKInstallPackageIdentifier = "com.netarx.poseidon";
}
When I built this package, I ran this command from within the NewPoseidonRoot directory:
pkgbuild --root ./
--identifier "com.netarx.poseidon"
--version "1.0.0"
--install-location "/Library/Application Support/Netarx"
--scripts ./scripts
--component-plist ./component.plist
--sign "Developer ID Installer: Steve P (xxxxxxxxxxx)"
../Poseidon.pkg
Here is my component.plist also:
<plist version="1.0">
<array>
<dict>
<key>RootRelativeBundlePath</key>
<string>Poseidon</string>
<key>BundleIsRelocatable</key>
<true/>
<key>BundleIsVersionChecked</key>
<true/>
<key>BundleHasStrictIdentifier</key>
<true/>
<key>BundlePreInstallScriptPath</key>
<string>scripts/preinstall.sh</string>
<key>BundlePostInstallScriptPath</key>
<string>scripts/postinstall.sh</string>
</dict>
</array>
</plist>
This produces the package without error, but for some reason when I run the installer, I see that the script preinstall.sh cannot be found. Any idea where I’m going wrong?