Proper environment handling on OSX