Search code examples
macospackagemaker

How to write preinstall script for packagemaker for Mac os


Hi I am using package-maker of Mac OS to create installer package for Mac OS. I gave created a simple installer package it worked fine. But I want to create a new folder under /Applications directory under which myApplication.app file will be installed. So I need to create a pre-install script which will create folder before my application is installed. then install the application in that directory. But I do not know how to write pre-install script to create a folder under /Applications directory. please help me.

I need all of your help to create pre-install script to create a folder under /Applications directory

Thanks Sunil Kumar Sahoo


Solution

  • To create a directory, you could have the following preflight or preinstall script:

    #!/bin/sh
    mkdir "/Applications/My Directory"
    

    Put that into a file (named preflight or preinstall) and then make it executable by typing in the terminal: chmod a+x preflight (or preinstall).