I am sorry I don't know how Mac works, but I can tell you what I do in Linux (with other's help in a seaside thread)
startMyApp.sh:
#!/bin/sh
#settings
NOHUP="/usr/bin/nohup"
VM="/home/mariano/squeak/expury/build/squeak"
# Para produccion, como no van a estar las X, tengo que poner el -vm-display-null
VM_PARAMS="-mmap 200m -vm-sound-null"
IMAGE="destinoMochila.image"
#start the vm
$NOHUP "$VM" $VM_PARAMS "$IMAGE" &
# store in a file the PID of squeakVM
echo $! > evince.pid
stopMyApp.sh:
#!/bin/bash
PID=`cat evince.pid`
kill -15 $PID || exit 0
sleep 2
kill -2 $PID || exit 0
sleep 2
kill -1 $PID || exit 0
sleep 2
kill -9 $PID || exit 0
This has three nice things:
1) Doesn't do a kill -9 first but it tries to kill the process with better signals
2) I store the pid in a file so that then I know which process to kill
3) I use nohup so that I can start the process and then close the terminal (suppose you are trough ssh).
I hope this helps,
Mariano