Haskell Platform with Mac OS X 10.9 (Mavericks)

XCode 5.0 on Mac OS X 10.9 (Mavericks) no longer provides GCC, only clang. According to Haskell Platform for Mac OS X,

Xcode 5 supplies clang as the C compier, and with respect to pre-processing there are some “differences of interpretation” between it and gcc. These differences can affect some Haskell code that uses the CPP extension.

There are two alternatives to solve this problem

  1. Download ghc-clang-wrapper.  Copy this script to /usr/bin, and make sure it is exectuable. Run it sudo.

  2. Install a gcc and direct GHC at that.

I installed Haskell Platform using MacPorts and confirmed that the first method works well. If ghc-clang-wrapper does not find where ghc is installed, you can manually edit /opt/local/lib/ghc-7.6.3/settings by replacing the line

(“C compiler command”, “/opt/local/bin/gcc-mp-4.7”),


(“C compiler command”, “/usr/bin/ghc-clang-wrapper”),