Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ToQoz/1589701 to your computer and use it in GitHub Desktop.
Save ToQoz/1589701 to your computer and use it in GitHub Desktop.
Installing GHC 7.2 on Mac OS X 10.7 Lion

Installing GHC 7.2 on Mac OS X

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.

Installing GHC

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 install

Installing cabal-install

Downloading, 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-install 0.10.3 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 by cabal-install's .cabal file.

cd -
curl -O http://hackage.haskell.org/packages/archive/cabal-install-ghc72/0.10.3/cabal-install-ghc72-0.10.3.tar.gz
tar xf cabal-install-ghc72-0.10.3.tar.gz
cd cabal-install-ghc72-0.10.3

The bootstrap.sh script is provided by cabal-install as an easy way to get cabal-install and 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 modify bootstrap.sh and 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.

Replace the whole block of version numbers and regexps with these new ones:

-SCOPE_OF_INSTALLATION="--user"
+SCOPE_OF_INSTALLATION="--global"

Finally, run the bootstrap script to install cabal-install.

sh bootstrap.sh

That should be it. Happy hacking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment