Skip to content

Preparing your system to use Stackage

Rufflewind edited this page Sep 7, 2014 · 13 revisions

Overview

These instructions are for users wishing to use Stackage Server as their package repository. There are two different tools that need to be installed on your system to use Stackage Server: GHC, and cabal-install. There are generally speaking two ways of getting these tools: via Haskell Platform, or installing them separately. We'll cover these options in a bit.

Currently, we support three different system configurations. Each of these options has its own set of Stackage snapshots available, and each of these in turn has exclusive and inclusive variants.

You'll need to choose the appropriate one of the above six snapshots based on what installation you do, and whether you want exclusive or inclusive snapshots. The links above will automatically redirect you to the most recent snapshot available.

Haskell Platform vs raw tools

Stackage Server is designed to work either with or without Haskell Platform. The decision on which route to take is entirely up to you; here are some general guidelines to help you decide:

  • On Windows, building cabal-install manually is difficult. Additionally, installing the network package requires installing an extra tool (msys). Unless you know what you're doing, you likely want to install Haskell Platform.

  • On Mac OS X, there are complications regarding the correct CPP toolchain to get set up. There are some scripts available to help, but the Haskell Platform provides a fully functioning toolset. Like Windows, you're likely safer sticking with Haskell Platform.

  • The biggest downside of Haskell Platform is that it ties you to older versions of dependencies. The biggest two examples in the current platform release are attoparsec and QuickCheck. For the former, the version included by Haskell Platform has a known security vulnerability. The QuickCheck version included is before a major API change, which a number of packages are beginning to use.

    The choice is yours, but my advice for users not on Windows or Mac is to not use Haskell Platform.

Set PATH to include cabal's bin directory

This applies to both Haskell Platform and manual installs. A very common source of confusion for new users is that executables are not available. For example, "I ran cabal install alex, but it's complaining that alex isn't available." It's vitally important that you make sure that your PATH environment variable is configured to include cabal's bin directory.

On most POSIX systems, this directory will be $HOME/.cabal/bin. A simple way to do this is to edit your ~/.bashrc and place in there:

export PATH=$HOME/.cabal/bin:$PATH

In Mac OS X, cabal installs binaries to: $HOME/Library/Haskell/bin.

In Windows Vista or newer Windows, cabal installs binaries to: %APPDATA%\cabal\bin. %APPDATA% is Windows specific Environment variable. Usually, this variable specifies C:\Users\%USERNAME%\AppData\Roaming.

Haskell Platform

If you've elected to install Haskell Platform, please follow the instructions on the Haskell Platform website.

NOTE: Distributions like Ubuntu often include a package including the Haskell Platform. Often, this package is very out-of-date, and will not be compatible with either Stackage Server or most recent releases of software on Hackage. Be sure you're installing version 2014.2.0.0 of the platform.

Manual installation

Most Linux distributions provide some means of installing GHC and cabal-install. Like with Haskell Platform, make sure you're installing a recent enough version of each tool. Stackage Server supports GHC 7.6.3 and 7.8.3. It will theoretically work with any version of cabal-install since 1.16, though I'd highly recommend using 1.18 or higher, since there are some important dependency solver bug fixes.

Instead of enumerating a bunch of distro-specific instructions here, please view the instructions from bitemyapp. Alternatively, you may follow the instructions below to get GHC and cabal-install directly:

1. Install GHC

GHC has its own web site with license information, FAQ, download links and changelogs. Depending on your operating system, there should be a package made for its package manager, otherwise (e.g. Windows) it will be an installer.

You can also download the .tar.gz/.zip and unpack and install the executables and so forth manually.

Or you can even install from source, for which there is documentation.

Download GHC now →

2. Install cabal-install

After installing GHC, you will want the Haskell package manager:

Get the Cabal archive →

Download the tar.gz file (listed under Downloads at the bottom of the page), extract and inside the resulting directory, run:

$ sh ./bootstrap.sh

This will automatically download and install all the packages necessary to setup Cabal install. You should now be able to run the cabal executable. To test this, run:

$ cabal update
Clone this wiki locally