Skip to content

Instantly share code, notes, and snippets.

@FrederickBor
Last active October 10, 2020 13:52
Show Gist options
  • Save FrederickBor/750a16b2e572a8c1b31c21a15779c8c2 to your computer and use it in GitHub Desktop.
Save FrederickBor/750a16b2e572a8c1b31c21a15779c8c2 to your computer and use it in GitHub Desktop.
How To Install Haskell on MacOS

How To Install Haskell on MacOS

Install Homebrew

First lets check if we have the xcode developers tools with:

$ xcode-select -p

If the command above dont give you a path then you should do:

$ xcode-select --install

After installing developers tools you can finally install the Homebrew with:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install GHC (Haskell compiler)

Let's install GHC with Homebrew using the following command:

$ brew install ghc

Now we can verify if it was installed with:

$ ghci                                                      
GHCi, version 8.10.1: https://www.haskell.org/ghc/  :? for help
Loaded package environment from /Users/frederick/.ghc/x86_64-darwin-8.10.1/environments/default
Prelude> :q
Leaving GHCi.

At the moment we have installed the compiler but we should install Cabal to allow us to download all dependencies for our codes, this can be done with:

$ brew install cabal-install
$ cabal update

Let's install one dependency: Numbers

$ cabal install numbers
$ cabal install --lib numbers

That's all folks, now we have installed Haskell, enjoy it and code carefully!

Optional: Install VS Code Extensions

In order to use Haskell on VS Code, I personally installed the following extensions:

  1. Haskell
  2. Haskell Syntax Highlighting
  3. haskell-linter

Hope you find this Gist useful!
Thank you for read it!

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