1
0
mirror of https://github.com/go-task/task.git synced 2025-03-19 21:17:46 +02:00
task/website/docs/installation.mdx
Pete Davison 27de441ed2
docs: updated installation guides (#1989)
* docs: updated installation guides

* fix: installation method titles in sidebar

* feat: add instructions for pip

* fix: anchors in installation doc
2025-01-02 18:20:29 +00:00

331 lines
9.4 KiB
Plaintext

---
slug: /installation/
sidebar_position: 2
toc_max_heading_level: 4
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
# Installation
Task offers many installation methods. Check out the available methods below.
:::info
Some of the methods below are marked as ![Community][community]. This means they
are not maintained by the Task team and may not be up-to-date.
:::
## Package Managers
### [Homebrew][homebrew] ![][macos] ![][linux] \{#homebrew}
Task is available via our official Homebrew tap [[source](https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb)]:
```shell
brew install go-task/tap/go-task
```
Alternatively it can be installed from the official Homebrew
repository [[package](https://formulae.brew.sh/formula/go-task)]
[[source](https://github.com/Homebrew/homebrew-core/blob/master/Formula/g/go-task.rb)] by running:
```shell
brew install go-task
```
### [Snap][snapcraft] ![][macos] ![][linux] \{#snap}
Task is available on [Snapcraft][snapcraft] [[source](https://github.com/go-task/snap/blob/main/snap/snapcraft.yaml)], but keep in mind that your Linux
distribution should allow classic confinement for Snaps to Task work correctly:
```shell
sudo snap install task --classic
```
### [npm][npm] ![][macos] ![][linux] ![][windows] \{#npm}
Npm can be used as cross-platform way to install Task globally or as a
dependency of your project
[[package](https://www.npmjs.com/package/@go-task/cli)] [[source](https://github.com/go-task/task/blob/main/package.json)]:
```shell
npm install -g @go-task/cli
```
### [pip][pip] ![][macos] ![][linux] ![][windows] ![][community] \{#pip}
Like npm, pip can be used as a cross-platform way to install Task
[[package](https://pypi.org/project/go-task-bin)] [[source](https://github.com/Bing-su/pip-binary-factory/tree/main/task)]:
```shell
pip install go-task-bin
```
### [WinGet][winget] ![][windows] \{#winget}
Task is available via the [community repository](https://github.com/microsoft/winget-pkgs) [[source](https://github.com/microsoft/winget-pkgs/tree/master/manifests/t/Task/Task)]:
```shell
winget install Task.Task
```
### [Chocolatey][choco] ![][windows] ![][community] \{#chocolatey}
[[package](https://community.chocolatey.org/packages/go-task)] [[source](https://github.com/Starz0r/ChocolateyPackagingScripts/blob/master/src/go-task_gh_build.py)]
```shell
choco install go-task
```
### [Scoop][scoop] ![][windows] ![][community] \{#scoop}
[[source](https://github.com/ScoopInstaller/Main/blob/master/bucket/task.json)]
```shell
scoop install task
```
### Arch ([pacman][pacman]) ![][arch] ![][community] \{#arch}
[[package](https://archlinux.org/packages/extra/x86_64/go-task/)] [[source](https://gitlab.archlinux.org/archlinux/packaging/packages/go-task)]
```shell
pacman -S go-task
```
### Fedora ([dnf][dnf]) ![][fedora] ![][community] \{#fedora}
[[package](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/)] [[source](https://src.fedoraproject.org/rpms/golang-github-task)]
```shell
dnf install go-task
```
### NixOS ([nix][nix]) ![][nixos] ![][linux] ![][community] \{#nix}
[[source](https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/go/go-task/package.nix)]
```shell
nix-env -iA nixpkgs.go-task
```
### [pacstall][pacstall] ![][debian] ![][ubuntu] ![][community] \{#pacstall}
[[package](https://pacstall.dev/packages/go-task-deb)] [[source](https://github.com/pacstall/pacstall-programs/blob/master/packages/go-task-deb/go-task-deb.pacscript)]
```shell
pacstall -I go-task-deb
```
### [pkgx][pkgx] ![][macos] ![][linux] ![][community] \{#pkgx}
[[package](https://pkgx.dev/pkgs/taskfile.dev)] [[source](https://github.com/pkgxdev/pantry/blob/main/projects/taskfile.dev/package.yml)]
```shell
pkgx task
```
or, if you have pkgx integration enabled:
```shell
task
```
## Get The Binary
### Binary
You can download the binary from the [releases page on GitHub][releases] and add
to your `$PATH`.
DEB and RPM packages are also available.
The `task_checksums.txt` file contains the SHA-256 checksum for each file.
### Install Script
We also have an [install script][installscript] which is very useful in
scenarios like CI. Many thanks to [GoDownloader][godownloader] for enabling the
easy generation of this script.
By default, it installs on the `./bin` directory relative to the working
directory:
```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
```
It is possible to override the installation directory with the `-b` parameter.
On Linux, common choices are `~/.local/bin` and `~/bin` to install for the
current user or `/usr/local/bin` to install for all users:
```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
```
:::caution
On macOS and Windows, `~/.local/bin` and `~/bin` are not added to `$PATH` by
default.
:::
By default, it installs the latest version available.
You can also specify a tag (available in [releases](https://github.com/go-task/task/releases))
to install a specific version:
```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d v3.36.0
```
### GitHub Actions
If you want to install Task in GitHub Actions you can try using
[this action](https://github.com/arduino/setup-task) by the Arduino team:
```yaml
- name: Install Task
uses: arduino/setup-task@v2
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}
```
This installation method is community owned.
## Build From Source
### Go Modules
Ensure that you have a supported version of [Go][go] properly installed and
setup. You can find the minimum required version of Go in the
[go.mod](https://github.com/go-task/task/blob/main/go.mod#L3) file.
You can then install the latest release globally by running:
```shell
go install github.com/go-task/task/v3/cmd/task@latest
```
Or you can install into another directory:
```shell
env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest
```
:::tip
For CI environments we recommend using the [install script](#install-script)
instead, which is faster and more stable, since it'll just download the latest
released binary.
:::
## Setup completions
Some installation methods will automatically install completions too, but if
this isn't working for you or your chosen method doesn't include them, you can
run `task --completion <shell>` to output a completion script for any supported
shell. There are a couple of ways these completions can be added to your shell
config:
### Option 1. Load the completions in your shell's startup config (Recommended)
This method loads the completion script from the currently installed version of
task every time you create a new shell. This ensures that your completions are
always up-to-date.
<Tabs values={[ {label: 'bash', value: '1'}, {label: 'zsh', value: '2'},
{label: 'fish', value: '3'},
{label: 'powershell', value: '4'}
]}>
<TabItem value="1">
```shell title="~/.bashrc"
eval "$(task --completion bash)"
```
</TabItem>
<TabItem value="2">
```shell title="~/.zshrc"
eval "$(task --completion zsh)"
```
</TabItem>
<TabItem value="3">
```shell title="~/.config/fish/config.fish"
task --completion fish | source
```
</TabItem>
<TabItem value="4">
```powershell title="$PROFILE\Microsoft.PowerShell_profile.ps1"
Invoke-Expression (&task --completion powershell | Out-String)
```
</TabItem></Tabs>
### Option 2. Copy the script to your shell's completions directory
This method requires you to manually update the completions whenever Task is
updated. However, it is useful if you want to modify the completions yourself.
<Tabs
values={[
{label: 'bash', value: '1'},
{label: 'zsh', value: '2'},
{label: 'fish', value: '3'}
]}>
<TabItem value="1">
```shell
task --completion bash > /etc/bash_completion.d/task
```
</TabItem>
<TabItem value="2">
```shell
task --completion zsh > /usr/local/share/zsh/site-functions/_task
```
</TabItem>
<TabItem value="3">
```shell
task --completion fish > ~/.config/fish/completions/task.fish
```
</TabItem></Tabs>
{/* prettier-ignore-start */}
[homebrew]: https://brew.sh
[snapcraft]: https://snapcraft.io/task
[winget]: https://github.com/microsoft/winget-cli
[choco]: https://chocolatey.org
[scoop]: https://scoop.sh
[pacman]: https://wiki.archlinux.org/title/Pacman
[dnf]: https://docs.fedoraproject.org/en-US/quick-docs/dnf
[nix]: https://nixos.org
[npm]: https://www.npmjs.com
[pip]: https://pip.pypa.io
[mise]: https://mise.jdx.dev
[aqua]: https://aquaproj.github.io
[pacstall]: https://github.com/pacstall/pacstall
[pkgx]: https://pkgx.sh
[go]: https://golang.org
[godownloader]: https://github.com/goreleaser/godownloader
[releases]: https://github.com/go-task/task/releases
[installscript]: https://github.com/go-task/task/blob/main/install-task.sh
[community]: https://img.shields.io/badge/Community%20Owned-orange
[windows]: https://custom-icon-badges.demolab.com/badge/Windows-0078D6?logo=windows11&logoColor=white
[macos]: https://img.shields.io/badge/MacOS-000000?logo=apple&logoColor=F0F0F0
[linux]: https://img.shields.io/badge/Linux-FCC624?logo=linux&logoColor=black
[arch]: https://img.shields.io/badge/Arch%20Linux-1793D1?logo=arch-linux&logoColor=fff
[fedora]: https://img.shields.io/badge/Fedora-51A2DA?logo=fedora&logoColor=fff
[nixos]: https://img.shields.io/badge/NixOS-5277C3?logo=nixos&logoColor=fff
[debian]: https://img.shields.io/badge/Debian-A81D33?logo=debian&logoColor=fff
[ubuntu]: https://img.shields.io/badge/Ubuntu-E95420?logo=ubuntu&logoColor=fff
{/* prettier-ignore-end */}