Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
Can you execute the script directly in Terminal by entering its full path? –  Daniel Beck May 28 '11 at 16:26

1 Answer 1

up vote 1 down vote accepted

Open Terminal and enter the following:

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

This will set the executable flag on the file.

share|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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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