Installation - The Lost Scrolls > Installation Scripts >
FAQ 001 - Troubleshooting Scripts
[Q] My script does not run. Where should I start?
For packages built with Packages
, Iceberg
, PackageMaker
and pkgbuild
:
- Check that your script is a plain text file and not a RTF file (if you created it with TextEdit for instance).
- Check the line ending for your script. You should use Unix line ending (LF).
- Check the file encoding for your script. You might use the Western (Mac Roman) file encoding.
- If you use shell or perl scripts, check that they start with
#!/bin/sh
or #!/usr/bin/perl
.
- Check that your script works when you run it from the Terminal. Just do not forget that the environment variables are not exactly the same than the ones available during the installation process.
For packages built with Iceberg
and older versions of PackageMaker
:
- Check the name of your script file inside your package. There should not be any file extension for the standard Installer scripts: InstallationCheck, VolumeCheck, postflight, preinstall, preupgrade, postinstall, postupgrade, postflight.
- Check the executable bit is set on your scripts.
- If your preinstall or postinstall script does not run, check that your package has not already been installed and that its receipt is not in /Library/Receipts or ~/Library/Receipts.
[Q] When I launch an application with open, it is run as root. Why?
[Q] My script fails when it's run during the installation process but works fine when I test in in the Terminal. Why?
- Check that your script returns 0 (with exit 0 for shell scripts).
- Have you taken into account that the script is run as root if you require admin authentication to install the package?
[Q] The new flat package format allows me to attach a preinstall or postinstall script to a bundle. How can I get the final installation of the bundle from such a script?
- The final installation path for the bundle is available in the $2 parameter (for a shell script).
[Q] Is there something I can improve in my script?
- Use absolute path for command line tools invoked by your shell script.
- Avoid using a script (either a pre-installation, post-installation or requirement one) to actually install your software.
It's very awkward when, for instance, an application gets fully installed after you've just allowed Installer.app to execute scripts and before the Welcome pane is reached.
Last Updated: 03/26/2020