LinuxCommandLibrary

ghcup

Manage Haskell toolchain installations (GHC, Cabal)

TLDR

Start the interactive TUI

$ ghcup tui
copy

List available GHC/Cabal versions
$ ghcup list
copy

Install the recommended GHC version
$ ghcup install ghc
copy

Install a specific GHC version
$ ghcup install ghc [version]
copy

Activate a specific GHC version
$ ghcup set ghc [version]
copy

Install cabal-install
$ ghcup install cabal
copy

Update ghcup itself
$ ghcup upgrade
copy

SYNOPSIS

ghcup [GLOBAL OPTIONS] <COMMAND> [<ARGS>]

PARAMETERS

-h, --help
    Show this help text

-V, --version
    Print ghcup version information

--numeric-version
    Print only numeric version

--debug
    Enable debug messages

--trace
    Print every action to stderr

-v, --verbose
    Verbose output (repeat for more verbosity)

--quiet
    Minimal stderr output, no progress or log

--force
    Overwrite existing files

--offline
    Skip metadata cache update

--no-tui
    Disable interactive TUI dialogs

install
    Install GHC, Cabal, Stack, HLS, etc.

uninstall
    Uninstall a tool

list
    List available tools and versions

set
    Set active/default tool version

unset
    Unset active tool version

upgrade-self
    Upgrade ghcup itself

tui
    Launch interactive text UI

env
    Print shell environment variables

whereis
    Locate installation paths

run
    Run Stack/Cabal with specific GHC

DESCRIPTION

GHCup is a cross-platform installer and version manager for the Haskell ecosystem, optimized for Linux (x86_64 and aarch64), macOS, *BSD, and Windows via MSYS2. It handles GHC (Glasgow Haskell Compiler), Cabal, Stack, HLS (Haskell Language Server), and more, supporting multiple versions, nightly builds, and bindists.

Key advantages include user-space installation (no root required), automatic binary caching, integrity verification (SHA-sum, GPG), and seamless switching via shell hooks. It outperforms system package managers by avoiding conflicts and providing latest releases. Commands allow listing versions, installing specifics like ghc 9.4.5, setting defaults, generating env vars, and running tasks with pinned GHC.

Recommended by the Haskell Foundation for production setups, GHCup simplifies workflows for developers, CI/CD, and reproducible environments. Integrates with direnv and supports offline mode post-setup.

CAVEATS

Requires internet for initial setup and updates; user installs don't affect system GHC. Needs curl/wget, unzip, patching tools. System-wide needs sudo.

INSTALLATION

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

WEBSITE

https://www.haskell.org/ghcup/

HISTORY

Released in 2020 by Mark Karpov as a modern Haskell installer, replacing ad-hoc scripts and Stack's bootstrap. Evolved under community/Haskell Foundation maintenance; now official GHC distribution method since 2021.

SEE ALSO

ghc(1), cabal(1), stack(1), hls(1)

Copied to clipboard