ghcup-hs/docs/install.md

5.8 KiB

Getting started

GHCup makes it easy to install specific versions of GHC on GNU/Linux, macOS (aka Darwin), FreeBSD and Windows and can also bootstrap a fresh Haskell developer environment from scratch. It follows the unix UNIX philosophy of do one thing and do it well. Similar in scope to rustup, pyenv and jenv.

Installation

The following commands will download the ghcup binary into ~/.ghcup/bin (or C:\ghcup\bin on windows) and then run it to interactively install the Haskell Toolchain. These commands should be run as non-root/non-admin user.

For Linux, macOS, FreeBSD or Windows Subsystem 2 for Linux, run this in a terminal:

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

For Windows, run this in a PowerShell session:

Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $true

If you want to know what these scripts do, check out the source code at the repository. Advanced users may want to perform a manual installation and GPG verify the binaries.

Which versions get installed?

GHCup has two main channels for every tool: recommended and latest. By default, it installs recommended.

latest follows the latest release of every tool, while recommended is at the discretion of the GHCup maintainers and based on community adoption (hackage libraries, tools like HLS, stackage support, etc.) and known bugs.

Also see tags and shortcuts for more information.

First steps

  1. To get started with creating a Haskell project, follow the Getting Started with Haskell and Cabal guide
  2. To properly learn Haskell, run through the CIS 194 Haskell course including exercises
  3. To learn more about Haskell Toolchain management, check out the ghcup user guide

Uninstallation

On linux, just run ghcup nuke, then make sure any ghcup added lines in your ~/.bashrc (or similar) are removed.

On windows, double-click on the Uninstall Haskell.ps1 PowerShell script on your Desktop.

Supported tools

GHCup supports the following tools, which are also known as the Haskell Toolchain:

  1. GHC
  2. cabal-install
  3. haskell-language-server
  4. stack

Supported platforms

This list may not be exhaustive and specifies support for bindists only.

Platform Architecture ghcup GHC cabal HLS stack
Windows 7 amd64
Windows 10 amd64
Windows Server 2016 amd64
Windows Server 2019 amd64
Windows Server 2022 amd64
Windows WSL1 amd64
Windows WSL2 amd64
MacOS >=10.13 amd64
MacOS <10.13 amd64
MacOS aarch64 ⚠️
FreeBSD amd64 ⚠️ ⚠️
Linux generic x86
Linux generic amd64
Linux generic aarch64 ⚠️ ⚠️
Linux generic armv7 ⚠️ ⚠️

Windows 7

May or may not work, several issues:

WSL1

Unsupported. GHC may or may not work. Upgrade to WSL2.

MacOS <13

Not supported. Would require separate binaries, since >=13 binaries are incompatible. Please upgrade.

MacOS aarch64

HLS bindists are still experimental. Stack is theoretically supported, but has no binaries yet.

FreeBSD

Lacks some upstream bindists and may need compat libs, since most bindists are built on FreeBSD-12. HLS bindists are experimental.

Linux ARMv7/AARCH64

Lower availability of bindists. HLS only has experimental ones. Stack not supported currently.

Manual install

Download the binary for your platform at https://downloads.haskell.org/~ghcup/ and place it into your PATH anywhere.

If you want to GPG verify the binaries, import the following key first: 7784930957807690A66EBDBE3786C5262ECB4A3F.

Then adjust your PATH in ~/.bashrc (or similar, depending on your shell) like so:

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

Vim integration

See ghcup.vim.

Get help