Create a gist now

Instantly share code, notes, and snippets.

@ion1 /install-ghc.md
Last active Oct 27, 2015

Installing GHC under the home directory

Installing GHC under the home directory

  1. Install stack.
  2. Run stack setup as a normal user. This will install GHC for you (under ~/.stack).
  3. Run stack ghci to start ghci. Please see the rest of the page linked above on how to use stack to create and build projects.

The old instructions: Installing GHC and Cabal under the home directory

  1. Install libgmp-dev or equivalent using the system package manager.
  2. Add export PATH="$HOME/.ghc/bin:$HOME/.cabal/bin:$HOME/.cabal-sandbox/bin:$PATH" to your .profile/.zprofile.
  3. Also run the command above now.
  4. Get the GHC binary tarball and extract it.
  5. ./configure --prefix="$HOME/.ghc" && make install
  6. Get the cabal-install source tarball and extract it.
  7. EXTRA_CONFIGURE_OPTS=-p sh bootstrap.sh
  8. cabal update
  9. Add library-profiling: True and documentation: True to ~/.cabal/config.
    • Add require-sandbox: True if you want to prevent accidental installation of packages outside a sandbox.

Purging both from the system

  1. rm -fr ~/.ghc ~/.cabal
  2. Remove the export PATH… line from your .*profile.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment