This is a brief and bare-bones guide to getting GHC 7.2 and the cabal-install
tool (the two basic things you'll need to do Haskell development) up and running
on a new Mac OS X 10.7 install.
The instructions given here worked for me, but YMMV.
Downloading and installing GHC 7.2.1 for x86_64 (Darwin) is straightforward.
curl -O http://www.haskell.org/ghc/dist/7.2.1/ghc-7.2.1-x86_64-apple-darwin.tar.bz2
tar -xjvf ghc-7.2.1-x86_64-apple-darwin.tar.bz2
cd ghc-7.2.1
./configure
make installDownloading, patching and installing the latest version of the cabal-install
tool is not quite so easy, but won't take long if you're careful (and you don't
run into problems that I didn't).
Patching is required because
-
cabal-install0.10.2 has a very conservative dependency list and many of the core packages included with GHC 7.2 have version numbers greater than many of the upper bounds given bycabal-install's.cabalfile. -
The
bootstrap.shscript is provided bycabal-installas an easy way to getcabal-installand all its dependencies up and running. However, it needs some changes to work under GHC 7.2. GHC 7.2 removes the random package from the distribution, so we need to modifybootstrap.shand have it install along with zlib, HTTP and the rest. We also need to update the list of packages to install to use more recent versions which will build under GHC 7.2.cd - curl -O http://hackage.haskell.org/packages/archive/cabal-install/0.10.2/cabal-install-0.10.2.tar.gz tar -xzvf cabal-install-0.10.2.tar.gz cd cabal-install-0.10.2 curl -O https://raw.github.com/gist/1432456/2cc64361f802c07dbfdd2d2e7f8cd48c51bba600/cabal-install-ghc722.patch cat cabal-install-ghc722.patch | git apply
Since the Cabal library comes with GHC, we also don't need it installed by the bootstrap script, so find the following two lines and comment them out:
# info_pkg "Cabal" ${CABAL_VER} ${CABAL_VER_REGEXP}
# do_pkg "Cabal" ${CABAL_VER} ${CABAL_VER_REGEXP}We want cabal-install and its dependencies to be installed globally, as though
they were being installed by something like the Haskell Platform, so the final
change to bootstrap.sh is to change the installation scope from --user to
--global. You can skip this step if you prefer to install cabal-install and
its dependencies locally.
SCOPE_OF_INSTALLATION="--global"Finally, run the bootstrap script to install cabal-install.
sh bootstrap.shThat should be it. Happy hacking!