--- packages/base/include/HsBase.h	2006-09-21 00:28:37.000000000 +0200
+++ packages/base/include/HsBase.h	2009-12-13 12:52:32.000000000 +0100
@@ -764,7 +764,13 @@
 
 /* ToDo: write a feature test that doesn't assume 'environ' to
  *    be in scope at link-time. */
-extern char** environ;
+#ifdef __APPLE__
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#else
+ extern char **environ;
+#endif
+
 INLINE char **__hscore_environ() { return environ; }
 
 /* lossless conversions between pointers and integral types */
