15

I installed Haskell on MAC OSX according to the instructions on this page.

Version 7.6.1 http://www.haskell.org/ghc/download_ghc_7_6_1

However, it does not install the cabal tool which I need for installing packages.

How can I install cabal?

Phil
  • 46,436
  • 33
  • 110
  • 175

3 Answers3

42

From the top of that page:

Stop!

For most users, we recommend installing the Haskell Platform instead of GHC. The current Haskell Platform release includes a recent GHC release as well as some other tools (such as cabal), and a larger set of libraries that are known to work together.

So following that link will get you what you want: the Haskell Platform is GHC plus the packages and tools you want, including Cabal (the library) and cabal-install (the command-line tool). Since you're on OS X, you can also use Homebrew to get the GHC and Cabal if you want: brew install ghc cabal-install.

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Antal Spector-Zabusky
  • 36,191
  • 7
  • 77
  • 140
  • 2
    Homebrew no longer supports `haskell-platform` and insists that you install `ghc` and `cabal-install`. It should be noted that `cabal` isn't able to find `-lgmp`; still trying to resolve this. Will edit if I find a fix. – Joe McMahon Oct 23 '14 at 19:54
  • @JoeMcMahon: Definitely good to mention. That said, though, is there a reason you can't just download the Haskell Platform [from the website](http://www.haskell.org/platform/)? It's even up to date (GHC 7.8.3) now! – Antal Spector-Zabusky Oct 23 '14 at 23:53
  • 1
    Managed to fix it: http://pemungkah.com/xmonad-on-os-x-mavericks/. Being able to "just install" with "brew install" and "cabal" is easier. – Joe McMahon Oct 24 '14 at 01:20
  • @JoeMcMahon ah ! i had this pb and thought i was the only one ! – nicolas Nov 30 '14 at 10:05
  • can you tell more about what was going on and what fixed it ? – nicolas Nov 30 '14 at 10:06
  • `export LIBRARY_PATH=/usr/local/lib:/usr/X11/lib` was what did the trick so `cabal` could find the libraries it needed. – Joe McMahon Dec 02 '14 at 21:47
  • Whats your suggestion when one needs to compile against older (today) version of ghc (<= 7.6), and needs appropriate versions of Cabal etc - all that on macOS Sierra? :D – Mati Dec 20 '16 at 20:54
  • @Mati: Well clearly you are not "most users"! :-) Unfortunately, I have no idea beyond that. You might try asking a new question here if you have something concrete, or posting something on [/r/haskell](http://www.reddit.com/r/haskell) or a similar place if you just want advice. – Antal Spector-Zabusky Dec 20 '16 at 21:08
  • @AntalSpector-Zabusky Thanks for advice! Im quite close - went with Vagrant, older Debian box and manually built both GHC & Cabal. (packages for older Debian releases are mostly deleted from their repositories). – Mati Jan 04 '17 at 15:58
1

Now, we can install it from this download haskell and do not need homebrew. Both are easy ways.

Shawn
  • 49
  • 2
0

As the Haskell Platform is deprecated since 2022, Haskell on Mac can be installed using Homebrew.

The Glasgow Haskell Compiler (GHC) and The Cabal Library can be installed using:

brew install ghc cabal-install

To install the The Haskell Tool Stack use:

brew install stack  --cask
Adrian Mole
  • 49,934
  • 160
  • 51
  • 83