fixing up makefile ofr osx apps
added file write function.  changed build system to make osx apps.