Step 1. Create a folder on the desktop called scripts.
Step 2. Create a script named “postinstall” and put it in the scripts folder on the Desktop.
NOTE: do not add .sh to your script name or it will fail. Best practice is to use a plain text editor when creating scripts. IE.. TextWrangler or pico in the CLI.
Step 3. Run the following command. Enter your administrator password when prompted.
sudo pkgbuild --identifier com.mypackage.com --nopayload --scripts /Users/work/Desktop/scripts /Users/work/Desktop/MyPayFree.pkg
Step 4. The package will be created and saved to your desktop.