Fix issue #1, improved error logging

Create ~/.MacOSX, if necessary before writing to environment.plist in it.