These instructions have been tested on Mojave 10.14.6 and Catalina 10.15.3.

Anti-virus software may interfere with the installation process. If you run into errors during the install, you can try temporarily disabling your anti-virus software.

If you experience problems during the installation process, you can go to a drop-in consultation session or ask for help on Ed.

Uninstall instructions (only if you have previously installed Haskell)

Note that there are many ways to install GHC, and therefore it is impossible for these uninstall instructions to work on all possible ways that GHC may have been installed. If you are having trouble removing a previous Haskell installation from your computer, please ask a tutor to help you uninstall Haskell from your machine before proceeding with the installation.

  1. Open a Terminal.
  2. Run sudo uninstall-hs all --remove and enter your account’s password.
  3. Run ghcup nuke.
  4. Run rm -rf ~/.ghcup ~/.ghc ~/.cabal.

Installing Haskell

  1. Install the command-line developer tools from a terminal by running the following command, and then click agree. This may take a few minutes.

    xcode-select --install
    

    1-mac
    2-mac

  1. Run the ghcup installer from a terminal by running the following command.

    curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_GHC_VERSION=9.2.5 sh
    

    You will then need to press enter a couple times when prompted. This will accept the default options.

    3-mac

    The installation will then commence. This may take several minutes.

  2. When the installation is complete, close the current terminal and open a new terminal.
  3. Check the GHC installation by running ghc --version and then checking that it says The Glorious Glasgow Haskell Compilation System, version 9.2.5.
  4. Let’s install the Haskell libraries we need for this course. Run the following command.

    cabal install --lib codeworld-api-0.8.0 && cabal install doctest
    

    Wait for the command to finish. This may take several minutes.

Congratulations! Your Haskell installation should now be ready to go.

VSCode Setup

  1. Go to https://code.visualstudio.com/download and select the Mac option.
  2. Double click the archive to extract the VSCode application.
  3. Drag the VSCode application into your Applications folder.
  4. Go to your Applications folder, and run VSCode by right clicking and selecting Open. You should only need to do this the first time - in future you can open it using the regular Application menu.
    7-mac
  5. Once VSCode is open, select “File > Preferences > Extensions”, search for haskell and install the “Haskell Syntax Highlighting” extension by clicking the Install button.
    haskell-syntax-highlighting
  6. Enable the “Auto Save” feature by clicking “File > Auto Save”. autosave
bars search times arrow-up