mirror of
https://github.com/go-task/task.git
synced 2024-12-14 10:52:43 +02:00
335 lines
8.2 KiB
Plaintext
335 lines
8.2 KiB
Plaintext
---
|
|
slug: /installation/
|
|
sidebar_position: 2
|
|
---
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
# Installation
|
|
|
|
Task offers many installation methods. Check out the available methods below.
|
|
|
|
## Package Managers
|
|
|
|
### Homebrew
|
|
|
|
If you're on macOS or Linux and have [Homebrew][homebrew] installed, getting
|
|
Task is as simple as running:
|
|
|
|
```shell
|
|
brew install go-task/tap/go-task
|
|
```
|
|
|
|
The above Formula is
|
|
[maintained by ourselves](https://github.com/go-task/homebrew-tap/blob/main/Formula/go-task.rb).
|
|
|
|
Recently, Task was also made available
|
|
[on the official Homebrew repository](https://formulae.brew.sh/formula/go-task),
|
|
so you also have that option if you prefer:
|
|
|
|
```shell
|
|
brew install go-task
|
|
```
|
|
|
|
### pkgx
|
|
|
|
If you're on macOS or Linux and have [pkgx][pkgx] installed, getting Task is as
|
|
simple as running:
|
|
|
|
```shell
|
|
pkgx task
|
|
```
|
|
|
|
or, if you have pkgx integration enabled:
|
|
|
|
```shell
|
|
task
|
|
```
|
|
|
|
This installation method is community owned. After a new release of Task, they
|
|
are automatically released by pkgx in a minimum of time.
|
|
|
|
### Snap
|
|
|
|
Task is available in [Snapcraft][snapcraft], but keep in mind that your Linux
|
|
distribution should allow classic confinement for Snaps to Task work right:
|
|
|
|
```shell
|
|
sudo snap install task --classic
|
|
```
|
|
|
|
### Chocolatey
|
|
|
|
If you're on Windows and have [Chocolatey][choco] installed, getting Task is as
|
|
simple as running:
|
|
|
|
```shell
|
|
choco install go-task
|
|
```
|
|
|
|
This installation method is community owned.
|
|
|
|
### Scoop
|
|
|
|
If you're on Windows and have [Scoop][scoop] installed, getting Task is as
|
|
simple as running:
|
|
|
|
```shell
|
|
scoop install task
|
|
```
|
|
|
|
This installation method is community owned. After a new release of Task, it may
|
|
take some time until it's available on Scoop.
|
|
|
|
### AUR
|
|
|
|
If you're on Arch Linux you can install Task from
|
|
[AUR](https://aur.archlinux.org/packages/go-task-bin) using your favorite
|
|
package manager such as `yay`, `pacaur` or `yaourt`:
|
|
|
|
```shell
|
|
yay -S go-task-bin
|
|
```
|
|
|
|
Alternatively, there's
|
|
[this package](https://aur.archlinux.org/packages/go-task) which installs from
|
|
the source code instead of downloading the binary from the
|
|
[releases page](https://github.com/go-task/task/releases):
|
|
|
|
```shell
|
|
yay -S go-task
|
|
```
|
|
|
|
This installation method is community owned.
|
|
|
|
### Fedora
|
|
|
|
If you're on Fedora Linux you can install Task from the official
|
|
[Fedora](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/)
|
|
repository using `dnf`:
|
|
|
|
```shell
|
|
sudo dnf install go-task
|
|
```
|
|
|
|
This installation method is community owned. After a new release of Task, it may
|
|
take some time until it's available in
|
|
[Fedora](https://packages.fedoraproject.org/pkgs/golang-github-task/go-task/).
|
|
|
|
### Nix
|
|
|
|
If you're on NixOS or have Nix installed you can install Task from
|
|
[nixpkgs](https://github.com/NixOS/nixpkgs):
|
|
|
|
```shell
|
|
nix-env -iA nixpkgs.go-task
|
|
```
|
|
|
|
This installation method is community owned. After a new release of Task, it may
|
|
take some time until it's available in
|
|
[nixpkgs](https://github.com/NixOS/nixpkgs).
|
|
|
|
### npm
|
|
|
|
You can also use Node and npm to install Task by installing
|
|
[this package](https://www.npmjs.com/package/@go-task/cli).
|
|
|
|
```shell
|
|
npm install -g @go-task/cli
|
|
```
|
|
|
|
### Winget
|
|
|
|
If you are using Windows and installed the
|
|
[winget](https://github.com/microsoft/winget-cli) package management tool, you
|
|
can install Task from [winget-pkgs](https://github.com/microsoft/winget-pkgs).
|
|
|
|
```shell
|
|
winget install Task.Task
|
|
```
|
|
|
|
### Pacstall
|
|
If you are using Debian or Ubuntu, and have [Pacstall](https://pacstall.dev/) installed, you can install Task by running:
|
|
|
|
```shell
|
|
pacstall -I go-task-deb
|
|
```
|
|
|
|
This installation method is community owned. After a new release of Task, it may take some time until it's available in [Pacstall](https://pacstall.dev/packages/go-task-deb).
|
|
|
|
## 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 */}
|
|
[go]: https://golang.org/
|
|
[snapcraft]: https://snapcraft.io/task
|
|
[homebrew]: https://brew.sh/
|
|
[installscript]: https://github.com/go-task/task/blob/main/install-task.sh
|
|
[releases]: https://github.com/go-task/task/releases
|
|
[godownloader]: https://github.com/goreleaser/godownloader
|
|
[choco]: https://chocolatey.org/
|
|
[scoop]: https://scoop.sh/
|
|
[pkgx]: https://pkgx.sh/
|
|
{/* prettier-ignore-end */}
|