Search code examples
macoshaskellinstallation

How to install Haskell on Mac OS


I am trying to install Haskell on my Macbook two days and can not get the success.

What I have done:

$ brew install ghc

Fine. Now I am trying to install

$ cabal install text

and get next error messages:

Data/Text.hs:1074:4:
     error: invalid preprocessing directive
      #-}
       ^

I have googled and found this.

So:

  • brew install gcc48

    $ /usr/local/bin/gcc-4.8 --version  
    gcc-4.8 (GCC) 4.8.2
    Copyright (C) 2013 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    $ cat /usr/local/lib/ghc-7.6.3/settings
      [("GCC extra via C opts", " -fwrapv"),
       ("C compiler command", "/usr/local/bin/gcc-4.8"),
       ("C compiler flags", " -m64 -fno-stack-protector  -m64"),
       ...
    
  • brew install cabal-install

  • cabal install text

And I get the same messages.

How can I fix them ?


Solution

  • Try using the Mac version of the Haskell Platform, I don't have a Mac to try it out but my hope is that cabal will work out-of-the-box in the Haskell Platform.