Table of Contents
We are providing the instructions below based on our experience installing GHC and other software in late 2008. Installation instructions inevitably become dated quickly; please bear this in mind as you read.
|How much room does GHC need?|
Our first step is to visit the GHC download
page, and follow the link to the current stable
release. Scroll down to the section entitled “Binary
packages”, and then again to the subsection for
Windows. Download the installer; in our case, it's named
|Updating your search path|
The GHC installer automatically modifies your
The Xcode software installer may have come bundled on a DVD with your Mac. If not (or you can't find it), you should be able to download it from Apple. Once you've finished installing Xcode, continue on to download GHC itself.
Visit the GHC download page, and follow the link to the current stable release. Scroll down to the section entitled “Binary packages”, and then again to the subsection for Mac OS X. There is a single installer package available. Download and run it.
|Terminal at your fingertips yet?|
Since most of your interactions with GHC
will be through a Terminal window, this might be a good
time to add the Terminal application to your dock, if you
haven't already done so. You can find it in the system's
These distros maintain a small core GHC package, which
is insufficient for much practical development. However, they
make a number of additional prebuilt packages available. To
see a complete list of these prebuilt packages, run
apt-cache search libghc6. We recommend
that you install at least the
mtl package, using
sudo aptitude install
sudo yum -y install ghc ghc-doc ghc683-prof
The base package, containing the ghc and ghci commands
and libraries, is
ghc-doc package contains the GHC user
guide, and command and library documentation. The
ghc683-prof package contains
profiling-capable versions of the standard libraries (note:
its version number may have changed by the time you read
Almost all Haskell libraries are distributed using a standard packaging system named Cabal. You can find hundreds of Haskell open source libraries and programs, all of which use Cabal, at http://hackage.haskell.org/, the home of the Hackage code repository.
A command named cabal automates the job
of downloading, building, and installing a Haskell package. It
also figures out what dependencies a particular library needs,
and either makes sure that they are installed already, or
downloads and builds those first. You can install any Haskell
package with a single cabal install
To build the cabal command, download the sources for the following four packages from http://hackage.haskell.org/
Follow the instructions in the section called “Building packages by hand” below to manually build each of
the four packages above, making sure that you leave
cabal-install until last.
After you install the
$HOME/.cabal/bin directory will
contain the cabal command. You can
either move it somewhere more convenient or add that
directory to your shell's search path.
If you download a tarball from Hackage, it will arrive in source form. Unpack the tarball, and go into the newly created directory in a command shell. The process to build and install it is simple, consisting of three commmands:
runghc Setup configure -p
runghc Setup configure --user --prefix=$HOME -p
runghc Setup build
sudo runghc Setup install
runghc Setup install
If you build by hand, you will frequently find that the configuration step fails because some other library must be installed first. You may find yourself needing to download and build several packages before you can make progress on the one you really want. This is why we recommend using the cabal command instead.