Mac OS package installer fails to install a simple test app

414 views Asked by At

I'm trying to figure an issue with building an install package for a Mac OS application. It's a simple hello world app and I use pkgbuild to do so.

If I simply package my app with no pre/post install scripts, the app installs fine. However, as soon as I add a preinstall script that does nothing but an echo, the installation fails with no meaningful message:

The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance.

This is the command that creates a successful install:

pkgbuild --component HelloMac.app --install-location /Applications  HelloMac${VERSION}.pkg

And this is the one that creates a pkg file that fails:

pkgbuild --component HelloMac.app --install-location /Applications --scripts scripts HelloMac${VERSION}.pkg

I have only one file called preinstall in the scripts folder and it has one line echo "hello"

How can I debug this failure? Or what else am I missing? Does the package need to be signed to run the scripts (mine is not)?

1

There are 1 answers

0
Lalith J. On

You have to specify the the Bash.

#!/bin/bash
echo hello
exit 0