Skip to content

Instantly share code, notes, and snippets.

@katychuang
Last active August 29, 2015 13:58
Show Gist options
  • Select an option

  • Save katychuang/9939239 to your computer and use it in GitHub Desktop.

Select an option

Save katychuang/9939239 to your computer and use it in GitHub Desktop.
Installing GHC from binary (OSX/Linux)

First remove any GHC, especially if you installed the platform edition. There is a script (https://gist.github.com/katychuang/9939239#file-removehaskellplatform-sh), which you should run in your terminal.


Install & Setup

GHC

  1. Download GHC 7.8.3 binary Download GHC 7.6.3 binary
  2. Unpack the archived file
  3. Read the INSTALL file for the directions
  4. Run ./configure
  5. Run make install
  6. Verify that it works with ghc --version

Cabal

  1. Install cabal
  2. Link the cabal app to the location ~/.cabal/bin

GCC

# Link gcc compiler version
$ brew install gcc-4.2
$ which gcc-4.2
$ vim /usr/local/lib/ghc-7.6.3/settings

change the 2nd line to..
("C compiler command", "/usr/local/bin/gcc-4.2"),

Full instructions on this page

a few more things*

# needed for binary installs

cabal install happy
cabal install alex

# update cabal version
cabal install cabal-install

Summary

Here's what your settings should look like

$ which ghc
/usr/local/bin/ghc

$ which cabal
~/.cabal/bin/cabal

$ which gcc-4.2
/usr/local/bin/gcc-4.2

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3

$ cabal --version
cabal-install version 1.18.0.3
using version 1.18.1.3 of the Cabal library

# Note: as of 4/20/2014 the newest cabal version is 1.20 http://blog.johantibell.com/2014/04/announcing-cabal-120.html

Running a project

A haskell project will contain a *.cabal file that lists the dependencies needed. The installations of these libraries are streamlined with the existence of Hackage and cabal package manager. You would run the command 'cabal install' to install dependencies and 'cabal build' to compile the code into a distributable application.

More information about using cabal can be found in the cabal guide.

# Instructions taken from http://www.haskell.org/pipermail/haskell-cafe/2011-March/090170.html
sudo rm -rf /Library/Frameworks/GHC.framework
sudo rm -rf /Library/Frameworks/HaskellPlatform.framework
sudo rm -rf /Library/Haskell
rm -rf ~/.cabal
rm -rf ~/.ghc
rm -rf ~/Library/Haskell
find /usr/bin /usr/local/bin -type l | xargs -If sh -c '/bin/echo -n f /; readlink f' | egrep '//Library/(Haskell|Frameworks/(GHC|HaskellPlatform).framework)' | cut -f 1 -d ' ' > /tmp/hs-bin-links
sudo rm `cat /tmp/hs-bin-links`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment