OSX Install without admin rights

I'm working on a scenario where I'd like haxe/hxcpp/neko/nekonme to be installed automatically and transparently as part of another installation.

In this case, I don't expect the user to know about haxe - so I'm looking for an installation that doesn't require any form of confirmation by the user.

Also I'm looking for a way to have the installation to happen without admin rights - in this way the resulting application could be completely portable.

So here is the script that, given a bare OSX Snow Leopard, installs haxe, hxcpp, neko and nekonme in the Documents directory.

There are currently two limitations with this approach:
1) it relies on setting a few environment libraries via the "export" command. These environment changes are not made persistent - rather they are local to the current shell session.
2) OSX users don't typically install XCode or gcc. So at the moment hxcpp generates the .cpp files but fails when trying to build the executable.

cd ~/Downloads
curl http://nekovm.org/_media/neko-1.8.1-osx.tar.gz > neko.tgz
curl http://haxe.org/file/haxe-2.07-osx.tar.gz > haxe.tgz
tar -zxvf neko.tgz
tar -zxvf haxe.tgz
rm haxe.tgz neko.tgz
export HAXEPATH=$HOME/Downloads/haxe-2.07-osx/
export NEKOPATH=$HOME/Downloads/neko-1.8.1-osx/
export DYLD_LIBRARY_PATH=$HOME/Downloads/neko-1.8.1-osx/
haxelib setup $HOME/Downloads/
haxelib install hxcpp
haxelib install nme
export HXCPP=$HOME/Downloads/hxcpp/
export HAXE_LIBRARY_PATH=$HOME/Downloads/haxe-2.07-osx/std/
export LD_LIBRARY_PATH=$HOME/Downloads/hxcpp/2,07,0/bin/Mac/
export LD_LIBRARY_PATH=$HOME/Downloads/nme/2,0,1/ndll/Mac/:$LD_LIBRARY_PATH
## and now some testing
cd nme/2,0,1/samples/02-Text
haxe compile.hxml
neko Sample.n
haxe -main Sample -cpp bin -lib nme
version #10733, modified 2011-07-06 17:26:48 by davidedc