The stack upgrade command¶
Either:
stack upgrade [--binary-only] [--binary-platform ARG] [--force-download]
[--[no-]only-local-bin] [--binary-version ARG] [--github-org ARG]
[--github-repo ARG]
or:
stack upgrade will get a new version of Stack. It can also get a version
before the current version (downgrade).
Warning
If you use GHCup to install Stack, use only GHCup to upgrade Stack.
By default:
-
the new version will be from an existing binary distribution. Pass the
--source-onlyflag to specify compiling from source code. The--binary-onlyand--source-onlyflags are alternatives; -
the new version will not overwrite the existing version unless it is newer. Pass the
--force-downloadflag to force a download; -
when an existing binary distribution is applicable, it will be put in Stack's local binary directory (see
stack path --local-bin) and namedstack(replacing any existing executable namedstackthere); -
if the current running Stack executable is '
stack' (that is, it was invoked asstackor, on Windows,stack.exe- this is case insensitive - and the Stack executable file is namedstackor, on Windows,stack.exe- this is case sensitive), an existing binary distribution will replace it. If the executable is located outside of Stack's local binary directory, pass the--only-local-binflag to skip that step; -
if the current running Stack executable is not '
stack' (as described above), an existing binary distribution will only be put in Stack's local binary directory and namedstack. Pass the--no-only-local-binflag to replace also the current running executable; -
the new version will be the latest available. Pass the
--binary-version <version>option to specify the version (this implies--force-download); -
the binary distribution will be sought from the GitHub organisation/user
commercialhaskell. Pass the--github-org <user>option to specify a different GitHub user; -
the binary distribution will be sought from the GitHub repository
stack. Pass the--github-repo <repository>option to specify a different repository; and -
the binary distribution will be sought for the current platform. Pass the
--binary-platform <platform>option to specify a different platform (<operating_system>-<architecture>-<suffix>).
When compiling from source code, by default:
- Stack will obtain the source code for the most recent version in the package
index (eg Hackage). Pass the flag
--gitto specify the most recent version from themasterbranch of Stack's repository (pass the option--git-branch <branch>to specify a different branch and the option--git-repo <repo_url>to specify a different repository).
Note
An earlier version of Stack could be inconsistent with some of the current contents of the Stack root. For further information about the contents of the Stack root and configuring its location, see the documentation about the Stack root.
Examples¶
-
stack upgradeseeks an upgrade to the latest version of Stack available as a binary distribution for the platform, if newer. -
stack upgrade --force-downloadseeks an upgrade to the latest version of Stack available as a binary distribution for the platform, even if not newer. -
If the Stack executable is invoked as
my-stack,my-stack upgradeseeks only to put the latest version of Stack available as a binary distribution for the platform, if newer, in Stack's local binary directory and name itstack.my-stack upgrade --no-only-local-binseeks also to upgrademy-stackto the latest version of Stack available. -
stack upgrade --binary-version 2.15.1seeks an upgrade to Stack 2.15.1 if available as a binary distribution for the platform, even if not newer. -
stack upgrade --source-onlyseeks an upgrade by building Stack with Stack from the latest version of the source code in the package index (i.e. Hackage). -
stack upgrade --source-only --gitseeks an upgrade by building Stack with Stack from the latest version of the source code in themasterbranch of Stack's repository.