Skip to content

Instantly share code, notes, and snippets.

@objectx
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save objectx/90afb587d43db22a09f5 to your computer and use it in GitHub Desktop.

Select an option

Save objectx/90afb587d43db22a09f5 to your computer and use it in GitHub Desktop.

Minimal Haskell Environment (on OSX Mavericks)

Prerequisite

  • Install Xcode 5.1 and enabling command line tools
  • Create GHC directory
    • I choose it as /opt/local/ghc-7.8.2 and chown’ed to me. 1

Install GHC

Download GHC binary package

$ curl http://www.haskell.org/ghc/dist/7.8.2/ghc-7.8.2-x86_64-apple-darwin-mavericks.tar.xz -o ghc-7.8.2.tar.xz

Build and Install

$ xz -dc ghc-7.8.2.tar.xz | tar -xvf -
$ cd ghc-7.8.2
$ ./configure —prefix=/opt/local/ghc-7.8.2
$ make install

Add /opt/local/ghc-7.8.2 to your $PATH (for building cabal)


Install cabal

Obtain cabal

$ git clone https://github.com/haskell/cabal.git

Build and Install cabal

Build and Install Cabal

$ cd cabal/Cabal
$ ghc -threaded --make Setup
$ ./Setup configure --user
$ ./Setup build
$ ./Setup install

Build and Install cabal-install 2

$ cd cabal/cabal-install
$ ./bootstrap.sh --user --no-doc

Add $HOME/.cabal/bin to your $PATH

Initialize package database

$ cabal update

Add common commands (optional)

$ cabal install haddock
$ cabal install hlint
$ cabal install stylish-haskell
$ cabal install haddock
$ cabal install ghc-mod

Note: Using above installation method, cabal controlled directory structure differs from HaskellPlatform’s one.3

Footnotes

  1. sudo mkdir /opt/local/ghc-7.8.2 && sudo chown USER:GROUP /opt/local/ghc-7.8.2

  2. --no-doc seems to be required at this moment (to avoid parsec build error)

  3. Everything stored under $HOME/.cabal (not using $HOME/Library/Haskell)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment