[Haskell-cafe] Self-contained GHC for Mac

Yitzchak Gale gale at sefer.org
Tue May 27 10:03:30 UTC 2014

Travis Cardwell wrote:
> I wrote an article explaining how I install multiple versions and avoid
> ~/.cabal hell (on Debian Wheezy):

Thanks for this detailed write up!
I have two comments:

1. When you switch to a different version of GHC using the PATH,
you also need to take into account the cabal command. Normally
you will want to be using the most recent cabal command, but
your procedure will switch you over to whatever version of the
cabal command was shipped with that version of GHC, because
that GHC bin directory now comes first in the PATH.

2. You don't need to have cabal-install installed globally.
All you need is the executable.

To fix these, add the following to your procedure:

1. Create the directory /usr/local/opt/cabal/bin

2. Create a new empty dir, cd into it, and run:

cabal sandbox init; cabal install cabal-install

Copy .cabal-sandbox/bin/cabal to

[Note: if the cabal bundled with your initial GHC
version is too old to support sandboxes, then
instead do

cabal install cabal-dev; cabal-dev install cabal-install

and then copy cabal-dev/bin/cabal to

3. Add /usr/local/opt/cabal/bin to your PATH, or install
/usr/local/opt/cabal using stow.

4. When you switch to a different version of GHC by
setting the PATH, do this instead of what you wrote:

export PATH=/usr/local/opt/cabal/bin:/usr/local/opt/ghc-7.6.3-2013.2.0.0/bin:$PATH


More information about the Haskell-Cafe mailing list