Mac – Postinstall Script Not Running in Package Maker

macpackage-makershell-script

I have created a installer from package maker and scripts I specified scripts directory and postinstall script. When I installs the package it application installs fine but the scripts I specified is not running. Somewhere I read executable bit must be set but I did not find from to set this bit.

Following is the is my script. In this I am setting path variables in plist. Please guide me on this..

#!/bin/bash    
FILE=~/.MacOSX/environment.plist
PLIST=/usr/libexec/PlistBuddy

# if the file doesn't exist, try to create folder
if [ ! -f $FILE ]
then
  mkdir -p ~/.MacOSX
fi

# then just add entries (file will be created if it doesn't exist)
$PLIST -c "Add :Variable1 string 'Value1'" $FILE
$PLIST -c "Add :Variable2 string 'Value2'" $FILE
echo "Ended" >> ok.txt
exit 0

enter image description here

Best Answer

Open Terminal and enter the following:

chmod +x /Users/sandy/Resource/PostInstall.sh

This will set the executable flag on the file.

Related Question