Skip to content
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
94 lines (71 sloc) 2.92 KB

Installing Cabal

Cabal comes in two parts, the cabal executable (which is in the cabal-install package) and the Cabal library (which is in the Cabal package).

Install cabal-install

These instructions copy the cabal executable to $HOME/bin which is assumed to be on your $PATH. If you have an alternative location where you prefer to put executables, then use that instead.

$ VER= # or if using 8.2.2 or higher.
$ wget${VER}/cabal-install-${VER}.tar.gz
$ tar xf cabal-install-${VER}.tar.gz
$ cd cabal-install-${VER}
$ EXTRA_CONFIGURE_OPTS="" ./ --sandbox --no-doc
# $HOME/bin is assumed to exist and be on your $PATH
$ cp .cabal-sandbox/bin/cabal $HOME/bin/cabal

Install Cabal

If you followed the advanced instructions here for installing multiple GHC versions, then you will need to repeat this step for each of the GHC versions that you have installed.

In order for custom Setup.hs files to operate correctly, cabal-install needs the Cabal library it was built against available in the user (or the global) package database.

If you installed a different cabal-install than the one above, or you didn't use the script, then make sure you run cabal --version to double check the version of the Cabal library that you need.

# double-check that we're installing the right version of the Cabal library
$ cabal --version
cabal-install version
using version of the Cabal library
# make sure we're not in a sandbox, jumping to $HOME is a safe bet
$ cd
$ cabal install Cabal-

If you need to install a newer Cabal library, you don't need to remove the old one, they should live side-by-side happily.

Locking down your user package database (optional)

If you want to make sure that nothing messes with your user package database, it can be helpful to set it to read-only. Just remember to make it writable if you ever need to install a newer Cabal library.

$ chmod -R -w $HOME/.ghc/x86_64-darwin-<GHC_VERSION>/package.conf.d

To make it writable again:

$ chmod -R +w $HOME/.ghc/x86_64-darwin-<GHC_VERSION>/package.conf.d

Troubleshooting / Next Steps

When running ./mafia quick or ./mafia watch, you may see something like the following from a fresh checkout:

    No instance for (Arbitrary time-1.4.2:Data.Time.Clock.UTC.UTCTime)

Run ghc-pkg list:


If there are extra packages in the .ghc packages directory, other than Cabal-*, then unregister them:

$ ghc-pkg list --user | grep -v 'package.conf.d' | grep -v 'Cabal-' | xargs ghc-pkg unregister
You can’t perform that action at this time.