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

331 lines
9.4 KiB
Plaintext
Raw Normal View History

---
slug: /installation/
sidebar_position: 2
toc_max_heading_level: 4
---
2024-09-02 20:21:53 +01:00
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
2018-09-22 18:44:24 -03:00
# Installation
Task offers many installation methods. Check out the available methods below.
2018-09-22 18:44:24 -03:00
:::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
2018-09-22 18:44:24 -03:00
### [Homebrew][homebrew] ![][macos] ![][linux] \{#homebrew}
2018-09-22 18:44:24 -03:00
Task is available via our official Homebrew tap [[source](https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb)]:
2018-09-22 18:44:24 -03:00
2024-01-25 14:53:13 +00:00
```shell
2018-09-22 18:44:24 -03:00
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:
2024-01-25 14:53:13 +00:00
```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:
2024-01-25 14:53:13 +00:00
```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)]:
2024-01-25 14:53:13 +00:00
```shell
npm install -g @go-task/cli
```
2024-01-25 14:53:13 +00:00
### [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}
2018-09-22 18:44:24 -03:00
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)]:
2018-09-22 18:44:24 -03:00
2024-01-25 14:53:13 +00:00
```shell
winget install Task.Task
2018-09-22 18:44:24 -03:00
```
### [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)]
2024-01-25 14:53:13 +00:00
```shell
choco install go-task
```
### [Scoop][scoop] ![][windows] ![][community] \{#scoop}
[[source](https://github.com/ScoopInstaller/Main/blob/master/bucket/task.json)]
2024-01-25 14:53:13 +00:00
```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)]
2020-01-25 15:44:55 +03:00
2024-01-25 14:53:13 +00:00
```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)]
2024-01-25 14:53:13 +00:00
```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)]
2024-01-25 14:53:13 +00:00
```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)]
2024-01-25 14:53:13 +00:00
```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)]
2024-01-25 14:53:13 +00:00
```shell
pkgx task
```
or, if you have pkgx integration enabled:
```shell
task
```
## Get The Binary
2022-06-11 19:17:29 -03:00
### 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.
2022-06-11 19:17:29 -03:00
### Install Script
2018-09-22 18:44:24 -03:00
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.
2018-09-22 18:44:24 -03:00
By default, it installs on the `./bin` directory relative to the working
directory:
2024-01-25 14:53:13 +00:00
```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:
2024-01-25 14:53:13 +00:00
```shell
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
2018-09-22 18:44:24 -03:00
```
:::caution
On macOS and Windows, `~/.local/bin` and `~/bin` are not added to `$PATH` by
default.
2018-09-22 18:44:24 -03:00
:::
2024-05-20 15:01:59 +02:00
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
```
2022-06-11 19:17:29 -03:00
### 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
2022-06-11 19:17:29 -03:00
### 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:
2024-01-25 14:53:13 +00:00
```shell
go install github.com/go-task/task/v3/cmd/task@latest
```
Or you can install into another directory:
2024-01-25 14:53:13 +00:00
```shell
env GOBIN=/bin go install github.com/go-task/task/v3/cmd/task@latest
```
:::tip
2023-03-30 22:05:20 -03:00
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.
:::
2022-10-25 20:54:17 +02:00
## Setup completions
2024-09-02 20:21:53 +01:00
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:
2022-10-25 20:54:17 +02:00
2024-09-02 20:21:53 +01:00
### Option 1. Load the completions in your shell's startup config (Recommended)
2022-10-25 20:54:17 +02:00
2024-09-02 20:21:53 +01:00
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.
2022-10-25 20:54:17 +02:00
2024-09-02 20:21:53 +01:00
<Tabs values={[ {label: 'bash', value: '1'}, {label: 'zsh', value: '2'},
{label: 'fish', value: '3'},
{label: 'powershell', value: '4'}
]}>
2022-10-25 20:54:17 +02:00
2024-09-02 20:21:53 +01:00
<TabItem value="1">
```shell title="~/.bashrc"
eval "$(task --completion bash)"
2022-10-25 20:54:17 +02:00
```
2024-09-02 20:21:53 +01:00
</TabItem>
2022-10-25 20:54:17 +02:00
2024-09-02 20:21:53 +01:00
<TabItem value="2">
```shell title="~/.zshrc"
eval "$(task --completion zsh)"
2022-10-25 20:54:17 +02:00
```
2024-09-02 20:21:53 +01:00
</TabItem>
2022-10-25 20:54:17 +02:00
2024-09-02 20:21:53 +01:00
<TabItem value="3">
```shell title="~/.config/fish/config.fish"
task --completion fish | source
2022-10-25 20:54:17 +02:00
```
2024-09-02 20:21:53 +01:00
</TabItem>
2022-10-25 20:54:17 +02:00
2024-09-02 20:21:53 +01:00
<TabItem value="4">
```powershell title="$PROFILE\Microsoft.PowerShell_profile.ps1"
Invoke-Expression (&task --completion powershell | Out-String)
2022-10-25 20:54:17 +02:00
```
2024-09-02 20:21:53 +01:00
</TabItem></Tabs>
2022-10-25 20:54:17 +02:00
2024-09-02 20:21:53 +01:00
### Option 2. Copy the script to your shell's completions directory
2022-10-25 20:54:17 +02:00
2024-09-02 20:21:53 +01:00
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.
2022-10-25 20:54:17 +02:00
2024-09-02 20:21:53 +01:00
<Tabs
values={[
{label: 'bash', value: '1'},
{label: 'zsh', value: '2'},
{label: 'fish', value: '3'}
]}>
2022-10-25 20:54:17 +02:00
2024-09-02 20:21:53 +01:00
<TabItem value="1">
2022-10-25 20:54:17 +02:00
```shell
2024-09-02 20:21:53 +01:00
task --completion bash > /etc/bash_completion.d/task
2022-10-25 20:54:17 +02:00
```
2024-09-02 20:21:53 +01:00
</TabItem>
2022-10-25 20:54:17 +02:00
2024-09-02 20:21:53 +01:00
<TabItem value="2">
```shell
task --completion zsh > /usr/local/share/zsh/site-functions/_task
2022-10-25 20:54:17 +02:00
```
2024-09-02 20:21:53 +01:00
</TabItem>
2022-10-25 20:54:17 +02:00
2024-09-02 20:21:53 +01:00
<TabItem value="3">
2022-10-25 20:54:17 +02:00
```shell
2024-09-02 20:21:53 +01:00
task --completion fish > ~/.config/fish/completions/task.fish
2022-10-25 20:54:17 +02:00
```
2024-09-02 20:21:53 +01:00
</TabItem></Tabs>
2022-10-25 20:54:17 +02:00
2024-03-19 19:48:46 +00:00
{/* 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
2018-09-22 18:44:24 -03:00
[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
2024-03-19 19:48:46 +00:00
{/* prettier-ignore-end */}