Install/upgrade¶

For mutual Un*ten operating systems (including macOS), all you need to practice is run:

          curl -sSL https://get.haskellstack.org/ | sh                  

or:

          wget -qO- https://become.haskellstack.org/ | sh                  

Note that this script volition enquire for root access using sudo in order to employ your platform's bundle manager to install dependencies and to install to /usr/local/bin. If yous prefer more than command, follow the transmission installation instructions for your platform below.

Binaries for other operating systems are listed beneath, and available on the GitHub release page. For the hereafter, we are open to supporting more than OSes (to asking 1, please submit an issue).

Binary packages are signed with this signing key.

If you are writing a script that needs to download the latest binary, y'all tin can use URLs like https://become.haskellstack.org/stable/<PLATFORM>.<EXTENSION> (eastward.1000. https://get.haskellstack.org/stable/linux-x86_64.tar.gz) that always indicate to the latest stable release.

Windows¶

We recommend installing to the default location with these installers, as that will make stack install and stack upgrade piece of work correctly out of the box.

  • Windows 64-bit Installer

If in doubt: you should prefer the 64-bit installer.

Y'all may meet a "Windows Defender SmartScreen prevented an unrecognized app from starting" warning when you endeavor to run the installer. If so, click on More than info, and then click on the Run anyway push that appears.

Manual download¶

  • Download the latest release:

    • Windows 64-bit
  • Unpack the annal and place stack.exe somewhere on your %PATH% (see Path section below) and you lot tin can and then run stack on the command line.

  • Now yous can run stack from the terminal.

macOS¶

We by and large exam on the electric current version of macOS and practise our best to keep information technology compatible with the three well-nigh contempo major versions. Stack may likewise work on older versions (YMMV).

Installer script¶

Run:

          curl -sSL https://become.haskellstack.org/ | sh                  

Manual download¶

  • Download the latest release:
    • macOS 64-chip
  • Extract the archive and place stack somewhere on your $PATH (come across Path section below)
  • At present you tin run stack from the final.

Using Homebrew¶

If you have the popular mash tool installed, you can but practise:

          brew install haskell-stack                  
  • The Homebrew formula and bottles are unofficial and lag slightly behind new Stack releases, but tend to be updated inside a day or two.
  • Normally, Homebrew will install from a pre-built binary (aka "pour from a bottle"), but if brew starts trying to build everything from source (which will have hours), see their FAQ on the topic.

Notes¶

Afterward installation, running stack setup might fail with configure: error: cannot run C compiled programs. in which case y'all should run:

          xcode-select --install                  

Starting with macOs x.fourteen (Mojave) running xcode-select --install might not be enough. You will need to install additional headers by running:

          cd /Library/Developer/CommandLineTools/Packages/ open macOS_SDK_headers_for_macOS_10.xiv.pkg                  

If you are on Os X 10.11 ("El Capitan") and run across either of these issues, see the linked FAQ entries:

  • GHC 7.eight.4 fails with /usr/bin/ar: permission denied
  • DYLD_LIBRARY_PATH is ignored

If you are on OS X 10.12 ("Sierra") and see GHC panic while building, run across this issue

Ubuntu¶

Utilize the generic Linux choice.

There is also a Ubuntu package for Ubuntu 16.10 and up, only the distribution's Stack version lags behind, so we recommend running stack upgrade --binary-only afterwards installing it. For older stack versions which do non support --binary-just, just stack upgrade may piece of work besides. The version in Ubuntu 16.04 is also old to upgrade successfully, so in that case stack should be installed from a release tarball.

Debian¶

Utilise the generic Linux choice.

There is besides a Debian bundle for Stretch and up, merely the distribution'south Stack version lags behind, and then running stack upgrade --binary-simply is recommended after installing it. For older stack versions which do not support --binary-but, merely stack upgrade may work too.

CentOS / Blood-red Lid / Amazon Linux¶

Apply the generic Linux option.

There is likewise an unofficial Copr repo. Annotation that this Stack version may lag backside, so nosotros recommend running stack upgrade afterward installing it.

Fedora¶

Employ the generic Linux option.

Fedora includes builds of stack, only the version may lag behind, so nosotros recommend running stack upgrade afterwards installing information technology.

openSUSE / SUSE Linux Enterprise¶

Utilise the generic Linux option.

In that location is also an unofficial SUSE package. Notation that this Stack version may lag behind, so we recommend running stack upgrade afterward installing it. To install it:

  1. Add the appropriate OBS repository:

    • openSUSE Tumbleweed

      all needed is in distribution

    • openSUSE Bound

                        sudo zypper ar http://download.opensuse.org/repositories/devel:/languages:/haskell/openSUSE_Leap_42.1/devel:languages:haskell.repo                                  
    • SUSE Linux Enterprise 12

                        sudo zypper ar http://download.opensuse.org/repositories/devel:/languages:/haskell/SLE_12/devel:languages:haskell.repo                                  
  2. Install:

                  sudo zypper in stack                          

Arch Linux¶

In that location is an official packet in the Arch customs repository. So you can install it by simply doing:

          sudo pacman -S stack                  

Annotation that this version may slightly lag behind, just information technology should exist updated within the day. The package is as well always rebuilt and updated when one of its dependencies gets an update.

  • stack latest stable version
  • haskell-stack-git git version

In club to use stack setup with older versions of GHC or on a 32-bit system, you may need the ncurses5-compat-libs AUR package installed. If this package is not installed, Stack may non be able to install older (< 7.10.three) or 32-bit GHC versions.

If you use the ArchHaskell repository, y'all can also become the haskell-stack-tool bundle from there.

NixOS¶

Users who follow the nixos-unstable channel or the Nixpkgs main branch can install the latest stack release into their profile by running:

          nix-env -f "<nixpkgs>" -iA stack                  

Alternatively, the bundle can be built from source every bit follows.

  1. Clone the git repo:

                  git clone https://github.com/commercialhaskell/stack.git                          
  2. Create a shell.nix file:

                  cabal2nix --trounce ./. --no-bank check --no-haddock > shell.nix                          

    Note that the tests fail on NixOS, so disable them with --no-check. Also, haddock currently doesn't piece of work for stack, so --no-haddock disables it.

  3. Install stack to your user contour:

                  naught-env -i -f shell.nix                          

For more information on using Stack together with Nix, delight meet the NixOS manual department on Stack.

Linux (generic)¶

Installer script¶

Run:

          roll -sSL https://get.haskellstack.org/ | sh                  

or:

          wget -qO- https://get.haskellstack.org/ | sh                  

Manual download¶

  • Download the latest release:

    • Linux 64-bit (static)
  • Extract the archive and place stack somewhere on your $PATH (encounter Path section below)

  • Ensure you have required system dependencies installed. These include GCC, GNU brand, xz, perl, libgmp, libffi, and zlib. We likewise recommend Git and GPG. To install these using your package manager:

    • Debian / Ubuntu: sudo apt-get install grand++ gcc libc6-dev libffi-dev libgmp-dev make xz-utils zlib1g-dev git gnupg netbase
    • Fedora / CentOS: sudo dnf install perl make automake gcc gmp-devel libffi zlib zlib-devel xz tar git gnupg (utilize yum instead of dnf on CentOS and Fedora <= 21)
      • Fedora 24: In order to use stack setup on a 32-chip system, you may need to run sudo dnf install ncurses-compat-libs. If this package is not installed, Stack may not be able to install 32-fleck GHC versions. As well sudo dnf install ncurses-compat-libs if yous nee
    • Arch Linux: sudo pacman -Southward make gcc ncurses git gnupg xz zlib gmp libffi zlib

      • In lodge to employ stack setup with older versions of GHC or on a 32-bit system, you may need the ncurses5-compat-libs AUR packet installed. If this package is not installed, Stack may not exist able to install older (< vii.x.3) or 32-chip GHC versions.
        • Gentoo users, make certain to accept the ncurses package with USE=tinfo (without it, stack will not be able to install GHC).
  • Now you lot tin can run stack from the terminal.

Path¶

You can install stack by copying it anywhere on your PATH environment variable. A good place to install is the same directory where stack itself will install executables. On Windows, that directory is %APPDATA%\local\bin, e.g. c:\Users\Michael\AppData\Roaming\local\bin. For other systems, information technology's $HOME/.local/bin.

If you lot don't have that directory in your PATH, you may need to update your PATH (such as by editing ~/.bashrc).

If you're curious about the choice of these paths, see issue #153

Beat out auto-completion¶

To get tab-completion of commands on bash, just run the following (or add it to .bashrc):

          eval "$(stack --fustigate-completion-script stack)"                  

For more information and other shells, see the beat out machine-completion page

China-based users¶

If y'all're attempting to install stack from within China:

  • As of 2020-02-24, the download link has express connectivity from within mainland China. If this is the instance, please go on past manually downloading (ideally via a VPN) and installing stack per the instructions found on this folio pertinent to your OS.

  • After install, your ~/.stack/config.yaml will need to be configured before stack can download large files consistently from within China (without reliance on a VPN). Delight add together the following to the bottom of the ~/.stack/config.yaml file (for Windows: utilize the %STACK_ROOT%\config.yaml):

          ###ADD THIS IF You Alive IN CHINA setup-info-locations:  - "http://mirrors.tuna.tsinghua.edu.cn/stackage/stack-setup.yaml" urls:   latest-snapshot: http://mirrors.tuna.tsinghua.edu.cn/stackage/snapshots.json  package-indices:   - download-prefix: http://mirrors.tuna.tsinghua.edu.cn/hackage/     hackage-security:         keyids:         - 0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d         - 1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42         - 280b10153a522681163658cb49f632cde3f38d768b736ddbc901d99a1a772833         - 2a96b1889dc221c17296fcc2bb34b908ca9734376f0f361660200935916ef201         - 2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3         - 51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921         - 772e9f4c7db33d251d5c6e357199c819e569d130857dc225549b40845ff0890d         - aa315286e6ad281ad61182235533c41e806e5a787e0b6d1e7eef3f09d137d2e9         - fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0         key-threshold: iii         ignore-expiry: no                  

Using an http proxy¶

To use stack behind a http proxy with ip accost IP and port PORT, first set up an environment variable http_proxy and then run the stack control. east.g.

          $ consign http_proxy=IP:PORT $ stack install                  

Note that on nearly operating systems, information technology is not mandatory for programs to follow the "arrangement-broad" http proxy. Some programs, such as browsers, exercise honor this "arrangement-wide" http proxy setting, while other programs, including fustigate, practise non. That ways configuring "http proxy setting" in your Control Console (Windows) or System Preferences (Mac) would not outcome in stack traffic going through the proxy.

Upgrade¶

There are essentially four different approaches to upgrade:

  • The stack tool itself ships with an upgrade command, which download a stack binary or build information technology from source and install it to the default install path (eastward.yard. ~/.local/bin or %APPDATA%\local\bin; meet the Path section above). You can employ stack upgrade to get the latest official release, and stack upgrade --git to install from Git and alive on the bleeding edge. Make sure the default install directory is on your PATH and takes precedence over the organization installed stack, or copy stack from that directory to the organisation location afterward. For more information, see this discussion.

  • If you're using a package manager and are happy with sticking with the officially released binaries from the distribution (which may the lag behind latest version of Stack significantly), simply follow your normal package director strategies for upgrading (due east.g. apt-get update && apt-become upgrade).

  • The become.haskellstack.org script supports the -f statement to over-write the current stack executable. For example:

    roll -sSL https://get.haskellstack.org/ | sh -south - -f

or:

                      wget -qO- https://get.haskellstack.org/ | sh -s - -f                  
  • Manually follow the steps above to download the newest binaries from the release page and replace the one-time binary.

Install Older Versions¶

To install a specific version of stack, navigate to the desired version on the GitHub release page, and click the appropriate link under its "Assets" drop-down carte du jour.

Alternatively, use the URL https://github.com/commercialhaskell/stack/releases/download/vVERSION/stack-VERSION-PLATFORM.EXTENSION. For example, the tarball for stack 2.1.0.1, osx-x86_64 is at https://github.com/commercialhaskell/stack/releases/download/v2.1.0.i/stack-2.ane.0.1-osx-x86_64.tar.gz.

Here'southward a snippet for appveyor.yml files, borrowed from dhall's appveyor.yml. Alter the values of PATH and VERSION as needed.

          install:   - set PATH=C:\Program Files\Git\mingw64\bin;%PATH%   - curl --silent --prove-error --output stack.zero --location "https://github.com/commercialhaskell/stack/releases/download/5%STACK_VERSION%/stack-%STACK_VERSION%-windows-x86_64.cypher"   - 7z ten stack.zip stack.exe   - stack setup > nul   - git submodule update --init --recursive