1

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

  • Can you execute the script directly in Terminal by entering its full path? – Daniel Beck May 28 '11 at 16:26
2

Open Terminal and enter the following:

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

This will set the executable flag on the file.

| improve this answer | |
  • 1
    Also, it's good practice to use #!/usr/bin/env bash instead of hard-coding the path to bash. – Daniel Beck May 28 '11 at 16:22
  • Sorry, blame that on me :) – slhck May 28 '11 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.