These instructions are deprecated
We now recommend you use Stack instead, but the instructions are preserved here for those that might want a minimal install.
What are Haskell, GHC, and Cabal?
Haskell is a programming language as laid out in the reports, most recent one being in 2010. The report is available as the onlinereport.
GHC is the most popular way to work in the Haskell language. It includes a compiler, REPL (interpreter), package management, and other things besides.
Cabal does project management and dependency resolution. It's how you'll install projects, typically into their own sandbox.
Cabal is equivalent to Ruby's Bundler, Python's pip, Node's NPM, Maven, etc. GHC manages packaging itself, Cabal chooses what versions to install.
Installing GHC & Cabal
This PPA is excellent and is what I use on all my Linux dev and build machines.
$ sudo apt-get update $ sudo apt-get install python-software-properties # v12.04 and below $ sudo apt-get install software-properties-common # v12.10 and above $ sudo add-apt-repository -y ppa:hvr/ghc $ sudo apt-get update $ sudo apt-get install cabal-install-1.24 ghc-7.10.3 happy-1.19.5 alex-3.1.4
Then prepend the following to your
$PATH (bash_profile, zshrc, bashrc, etc):
Optional: You could also add
.cabal-sandbox/bin to your path. Code that you
are actively developing will be available to you from the command line. This
only works when your current working directory is a cabal sandbox.
Using Ubuntu PPA
If you're not using stable, you can follow the same steps as Ubuntu, but will
have to execute an additional command. Immediately after
sudo add-apt-repository -y ppa:hvr/ghc is executed run:
$ sudo sed -i s/jessie/trusty/g /etc/apt/sources.list.d/hvr-ghc-jessie.list
For other Debian versions, just replace all occurences of
jessie with your
version name in the command above.
If, for some reason, the file
not exist, then
/etc/apt/sources.list should contain a line like this:
deb http://ppa.launchpad.net/hvr/ghc/ubuntu jessie main
trusty in this line.
You can follow this guide written for Mac OS X:
- Set your prefix accordingly when configuring ghc.
- Instead of grabbing the
cabal-installbinary, grab the source and then run
To install Haskell 7.8.4 from the unofficial repo (Fedora 22+ will include it in the official one):
$ sudo yum-config-manager --add-repo \ > https://copr.fedoraproject.org/coprs/petersen/ghc-7.8.4/repo/fedora-21/petersen-ghc-7.8.4-fedora-21.repo $ sudo yum install ghc cabal-install
As stated in petersen/ghc-7.8.4 copr page this ghc cannot be installed in parallel with Fedora/EPEL ghc.
To install Haskell from the official repos on Arch Linux, run
$ sudo pacman -S cabal-install ghc happy alex haddock
On Gentoo, you can install the individual components of the Haskell Platform
through Portage. If you use
ACCEPT_KEYWORDS=arch (as opposed to
ACCEPT_KEYWORDS=~arch), Portage will install ancient versions of the various
Haskell things. With that in mind, iff you use
ACCEPT_KEYWORDS=arch, add the
Once that is done,
$ emerge -jav dev-lang/ghc dev-haskell/cabal-install
Gentoo keeps a "stable" (read: old) version of
cabal-install in the Portage
tree, so you'll want to use
cabal-install to install the more recent
version. Note that the backslashes are intentional.
$ \cabal update # The backslashes $ \cabal install cabal-install # are intentional
You have now installed cabal on a global scale with portage, and locally in your
home directory with
cabal-install. The next step is to make sure that when you
cabal in a terminal, your shell will run the up-to-date version in your
home directory. You will want to add the following lines to your shell's
PATH=$PATH:$HOME/.cabal/bin alias cabal="$HOME/.cabal/bin/cabal"
If you don't know what your shell is, more than likely, your shell is Bash. If
you use Bash, the file you will edit is
~/.bashrc. If you use Z-shell, the
~/.zshrc. You can run the following command to find out what your
echo $SHELL | xargs basename
I use zsh, so that command outputs
zsh when I run it.
Once you do all of that, you'll want to install the additional tools
$ cabal install alex happy
Congratulations! You now have a working Haskell installation!
Mac OS X
Install the GHC for Mac OS X app, which
includes GHC and Cabal. It provides instructions on how to add GHC and Cabal to
your path after you've dropped the
Do the binary distribution install described below with this tarball.
- The Minimum GHC Installer
is able to compile
networkand other libraries. It includes a minimal GHC environment along with Cabal and MSYS (the compiler environment that allows you to install things like
The minghc web page does have a few additional details, but note that the default is to install to your local AppData directory rather than a system-wide directory. (C:\Users<username>\AppData\Local\Programs)
Other Linux users
Download the latest binary distributions for cabal and ghc:
Users of other Unix-like Systems
Install GHC and Cabal from your package system, then add
~/.cabal/bin to your
$PATH. Finally update
cabal and install the additional tools
$ cabal update $ cabal install cabal-install alex happy