fix for OSX window mode

OSX failed to read environment variables when emacs ran in window mode. This patch fixes that.