gup
Update binaries installed by "go install"
About gup
This large README is shown as a plain-text preview. Read the full README at the source
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
[](https://github.com/nao1215/gup/actions/workflows/unit_test.yml)
[](https://github.com/nao1215/gup/actions/workflows/e2e.yml)

[](https://github.com/nao1215/gup/actions/workflows/gitleaks.yml)
[](https://github.com/nao1215/gup/actions/workflows/trivy.yml)
[](https://github.com/nao1215/gup/actions/workflows/govulncheck.yml)
[](https://github.com/nao1215/gup/actions/workflows/gosec.yml)
[](https://github.com/nao1215/gup/actions/workflows/reviewdog.yml)
[](https://github.com/nao1215/atago)
[](https://github.com/nao1215/himorime)
[](https://pkg.go.dev/github.com/nao1215/gup)
[](https://github.com/nao1215/gup/releases)
[](./LICENSE)
[](https://scorecard.dev/viewer/?uri=github.com/nao1215/gup)
[](https://www.bestpractices.dev/projects/14989)
[](https://github.com/avelino/awesome-go)

`go install` puts a program in `$GOBIN` (`$GOPATH/bin`) and never updates it again. gup updates every binary there in parallel, pins the ones that must stay at a version, lists and checks what is installed, removes binaries, exports the set to `gup.json` so another machine can import it, and migrates it to a new `$GOBIN`. It runs on Windows, macOS, and Linux.
```shell
go install github.com/nao1215/gup@latest
gup check # report what is out of date, install nothing
gup update # update everything under $GOBIN
```
`go install` puts gup in `$GOBIN` (by default `$GOPATH/bin`), which must be on your `PATH`.
Documentation: https://nao1215.github.io/gup/
## Supported OS
Unit tests run on GitHub Actions for:
- Linux
- Mac (macOS 13 Ventura or newer, the range Go 1.27 supports)
- Windows
### Supported Go versions
Unit tests run on Go 1.26 and 1.27. Building from source needs Go 1.26 or newer. The release binaries are built with the latest Go 1.27 patch release, so on macOS they need macOS 13 Ventura or newer.
## How to install
gup is in homebrew-core, winget, the mise and aqua registries, nixpkgs, and the AUR. You can also use `go install` or a prebuilt package from the release page.
### Use "go install"
You need [Go](https://go.dev/doc/install) 1.26 or newer. On an older Go, use a prebuilt binary or a package below.
```
go install github.com/nao1215/gup@latest
```
### Use homebrew
homebrew-core has gup, so no tap is needed:
```shell
brew install gup
```
The tap `nao1215/tap` also has a GoReleaser-built formula that installs the prebuilt release binary:
```shell
brew install nao1215/tap/gup
```
### Use winget (Windows)
```shell
winget install --id nao1215.gup
```
### Use mise-en-place
```shell
mise use -g gup@latest
```
### Use nix (Nix profile)
```shell
nix profile install nixpkgs#gogup
```
### Use aqua
gup is in the [aqua](https://aquaproj.github.io/) standard registry. Add it to your `aqua.yaml`:
```shell
aqua g -i nao1215/gup
```
### Use the AUR (Arch Linux)
There are two community packages: [`gup`](https://aur.archlinux.org/packages/gup) builds from source, and [`gup-bin`](https://aur.archlinux.org/packages/gup-bin) installs the release binary.
```shell
paru -S gup # or: yay -S gup
paru -S gup-bin # prebuilt binary
```
### Install from a package or binary
[The release page](https://github.com/nao1215/gup/releases) has .deb, .rpm, and .apk packages for `amd64` and `arm64`, plus `.tar.gz` archives for Linux/macOS and `.zip` archives for Windows. gup runs the go command, so Go must be installed either way.
Download the package for your distribution and architecture, then:
```shell
# Debian, Ubuntu
$ sudo dpkg -i gup_1.8.1_linux_amd64.deb
# Fedora, RHEL, openSUSE
$ sudo rpm -Uvh gup_1.8.1_linux_amd64.rpm
# Alpine Linux
$ sudo apk add --allow-untrusted gup_1.8.1_linux_amd64.apk
```
Replace `1.8.1` with the release you downloaded and `amd64` with `arm64` where applicable. The packages also install the bash, fish, and zsh completion files.
## Verifying release integrity
Each release has a `checksums.txt` signed with [cosign](https://github.com/sigstore/cosign) (keyless, bundle in `checksums.txt.sigstore.json`), an SPDX SBOM for each archive, and SLSA build provenance attested via GitHub OIDC and attached as `multiple.intoto.jsonl`.
Verify the signed checksums, then check your archive against `checksums.txt`:
```shell
cosign verify-blob \
--bundle checksums.txt.sigstore.json \
--certificate-identity-regexp 'https://github.com/nao1215/gup/\.github/workflows/release\.yml@refs/tags/.*' \
--certificate-oidc-issuer 'https://token.actions.githubusercontent.com' \
checksums.txt
sha256sum --check --ignore-missing checksums.txt
```
Verify the build provenance of a downloaded artifact with the GitHub CLI:
```shell
gh attestation verify gup_<version>_<os>_<arch>.tar.gz --repo nao1215/gup
```
Or download `multiple.intoto.jsonl` and check the archive with [slsa-verifier](https://github.com/slsa-framework/slsa-verifier), which verifies the provenance signature against the Sigstore transparency log:
```shell
slsa-verifier verify-artifact gup_<version>_<os>_<arch>.tar.gz \
--provenance-path multiple.intoto.jsonl \
--source-uri github.com/nao1215/gup \
--source-tag v<version>
```
## How to use
### Check the gup version
Use the `version` subcommand or the `--version`/`-V` flag.
```shell
$ gup --version
$ gup version
```
### Update all binaries
`gup update` updates every binary under `$GOBIN` in parallel.

### Update the specified binary
Name the binaries, separated by spaces.
```shell
$ gup update subaru gup ubume
update binary under $GOPATH/bin or $GOBIN
[1/3] github.com/nao1215/gup (v0.7.0 to v0.7.1, go1.20.1 to go1.22.4)
[2/3] github.com/nao1215/subaru (Already up-to-date: v1.0.2 / go1.22.4)
[3/3] github.com/nao1215/ubume/cmd/ubume (Already up-to-date: v1.4.1 / go1.22.4)
```
### Exclude binaries during gup update
List the binaries to skip, separated by commas without spaces. It also works with `--dry-run`. A name that is not installed is ignored, so one list can be shared between machines; if it looks like a typo of an installed binary, gup prints a "did you mean" warning.
```shell
$ gup update --exclude=gopls,golangci-lint //--exclude or -e, this example will exclude 'gopls' and 'golangci-lint'
```
### Update binaries with @main, @master, or @latest
Choose the update source per binary:
- `--main` (`-m`): update by `@main` (falls back to `@master` only when the repository has no `main` branch)
- `--master`: update by `@master`
- `--latest`: update by `@latest`
Only a missing `main` branch triggers the fallback to `@master`. Build, network, authentication, timeout, and cancellation failures are reported as they are.
gup saves the channel to `gup.json` and reuses it on later `gup update` runs.
```shell
$ gup update --main=gup,lazygit --master=sqly --latest=air
```
### Pin a tool to a specific version
Pin a tool that must match CI or the rest of your team. `gup update` leaves it at that version and updates everything else.
```shell
$ gup pin golangci-lint v1.62.0
$ gup update
```
The version must be one fixed version: a full version (`v1.62.0`), a prerelease (`v2.0.0-rc.1`), a `+incompatible` version of a v2+ module (`v2.0.0+incompatible`), or a pseudo-version (`v0.0.0-20240102150405-abcdef123456`). `go list -m <module>@<commit>` prints the pseudo-version of a commit. `gup pin` rejects branch names, commit hashes, abbreviated versions such as `v1` or `v1.2`, and queries such as `>=v1.2.0`, because the go command would resolve them again on every run. The check uses neither the network nor the go command, so a well-formed version that does not exist is reported later, by `gup update`.
The pin is stored in `gup.json`:
```json
{
"schema_version": 2,
"packages": [
{
"name": "golangci-lint",
"import_path": "github.com/golangci/golangci-lint/cmd/golangci-lint",
"version": "v1.62.0",
"channel": "pinned"
}
]
}
```
To allow the tool to update again:
```shell
$ gup unpin golangci-lint
```
If a hand-edited `gup.json` has a pin that is not one fixed version, every command that reads it (`update`, `import`, `check`, `pin`, ...) fails and names the file, the tool, and the value. gup does not fall back to `@latest` or drop the pin. Set the entry's `"version"` to a full version or a pseudo-version, or set its `"channel"` to `"latest"` to unpin it.
### List installed binaries
`gup list` prints the name, package path, and version of each binary under $GOPATH/bin or $GOBIN.

### Remove the specified binary
`gup remove` deletes binaries under $GOPATH/bin or $GOBIN, asking before each one.
```shell
$ gup remove subaru gal ubume
gup:CHECK: remove /home/nao/.go/bin/subaru? [Y/n] Y
removed /home/nao/.go/bin/subaru
gup:CHECK: remove /home/nao/.go/bin/gal? [Y/n] n
cancel removal /home/nao/.go/bin/gal
gup:CHECK: remove /home/nao/.go/bin/ubume? [Y/n] Y
removed /home/nao/.go/bin/ubume
```
`--force` skips the question.
```shell
$ gup remove --force gal
removed /home/nao/.go/bin/gal
```
### Check if the binary is the latest version
`gup check` reports which binaries have a newer version and prints the `gup update` command for them.
```shell
$ gup check
check binary under $GOPATH/bin or $GOBIN
[ 1/33] github.com/cheat/cheat (Already up-to-date: v0.0.0-20211009161301-12ffa4cb5c87 / go1.22.4)
[ 2/33] fyne.io/fyne/v2 (current: v2.1.3, latest: v2.1.4 / current: go1.20.2, installed: go1.22.4)
:
[33/33] github.com/nao1215/ubume (Already up-to-date: v1.5.0 / go1.22.4)
If you want to update binaries, the following command.
$ gup update fyne_demo gup mimixbox
```
You can also check only the binaries you name.
```shell
$ gup check lazygit mimixbox
check binary under $GOPATH/bin or $GOBIN
[1/2] github.com/jesseduffield/lazygit (Already up-to-date: v0.32.2 / go1.22.4)
[2/2] github.com/nao1215/mimixbox (current: v0.32.1, latest: v0.33.2 / go1.22.4)
If you want to update binaries, the following command.
$ gup update mimixbox
```
### Quiet output for large tool sets
`--quiet` (`-q`) hides the up-to-date lines from `check` and `update`. You see the binaries that were updated or have an update, the failures, and a one-line summary. Errors still go to STDERR. With `--json`, `--quiet` is ignored and the full array is printed.
```shell
$ gup update --quiet
github.com/nao1215/gup (v0.7.0 to v0.7.1)
gup: 1 updated, 8 up-to-date, 0 failed
$ gup check -q
github.com/nao1215/gup (current: v0.7.0, latest: v0.7.1 / go1.22.4)
If you want to update binaries, run the following command.
$ gup update gup
gup: 1 update available, 8 up-to-date, 0 failed
```
### Machine-readable JSON output (for scripting / CI)
`list`, `check`, and `update` print a JSON array with `--json`.
```shell
$ gup check --json
[
{
"name": "gup",
"import_path": "github.com/nao1215/gup",
"module_path": "github.com/nao1215/gup",
"channel": "latest",
"current_version": "v1.0.0",
"latest_version": "v1.1.0",
"current_go_version": "go1.22.4",
"installed_go_version": "go1.22.4",
"status": "update-available"
}
]
```
The fields are listed in the [reference](https://nao1215.github.io/gup/reference/#json-output-fields).
### Hints when an update fails
When `update` or `check` fails, gup prints a next step on STDERR after the go command's error. With `--json`, the same text is in the `hint` field.
```shell
$ gup update
gup:ERROR: [1/1] tool: can't install gup.test/moved/cmd/tool:
go: gup.test/moved/cmd/tool@latest: module gup.test/moved@latest found (v1.1.0), but does not contain package gup.test/moved/cmd/tool
gup:HINT : The module no longer provides this command at its import path. The project likely moved to a new major version (e.g. a `/v2` module path) or relocated the command; check its current install instructions and reinstall with the new path.
```
### Export and import the tool set
`gup export` writes each tool's import path, version, and update channel to `gup.json`, and `gup import` installs that set on another machine. The schema and the lookup order are in the [reference](https://nao1215.github.io/gup/reference/#gupjson).
```json
{
"schema_version": 1,
"packages": [
{
"name": "gal",
"import_path": "github.com/nao1215/gal/cmd/gal",
"version": "v1.1.1",
"channel": "latest"
},
{
"name": "posixer",
"import_path": "github.com/nao1215/posixer",
"version": "v0.1.0",
"channel": "main"
}
]
}
```
Copy `gup.json` to the other machine (or keep it in your dotfiles) before running `gup import` there.
```shell
※ Environments A (e.g. ubuntu)
$ gup export
Export /home/nao/.config/gup/gup.json
※ Environments B (e.g. debian)
$ gup import
```
`export --output` prints the config to STDOUT, and `import --file` reads a given file.
```shell
※ Environments A (e.g. ubuntu)
$ gup export --output > gup.json
※ Environments B (e.g. debian)
$ gup import --file=gup.json
```
### Migrate binaries to a new $GOBIN
```shell
gup migrate BEFORE_PATH AFTER_PATH [BINARY...]
```
`gup migrate` reinstalls the binaries under `BEFORE_PATH` into `AFTER_PATH` at the `import path@version` recorded in each binary's build info, so nothing moves to `@latest`. It sets `GOBIN` to `AFTER_PATH` and runs `go install`, so the binaries are rebuilt with the current Go toolchain, or with the newer Go a binary was built with, as `update` does.
#### Why this is useful (e.g. with `mise`)
With [`mise`](https://mise.jdx.dev/), each Go version can have its own `$GOBIN`, so after a Go update the new Go no longer sees the tools in the old one. `gup migrate` reinstalls them into the new `$GOBIN`:
```shell
# Reinstall every go-install tool from the old GOBIN into the new GOBIN
$ gup migrate ~/.local/share/mise/installs/go/1.24.0/bin ~/.local/share/mise/installs/go/1.25.0/bin
# Migrate only specific binaries
$ gup migrate /old/gobin /new/gobin gopls air
```
`migrate` only adds files. It never deletes anything in `AFTER_PATH`, skips binaries that already exist there unless you pass `--force`, and creates `AFTER_PATH` if it is missing. `BEFORE_PATH` and `AFTER_PATH` must be different directories.
### Generate man-pages (for linux, mac)
`gup man` writes man pages to /usr/share/man/man1 by default. If `MANPATH` is set, gup writes to the `man1` directory under each entry instead and creates it if needed. An unwritable target exits with an error.
```shell
$ sudo gup man
Generate /usr/share/man/man1/gup-bug-report.1.gz
Generate /usr/share/man/man1/gup-check.1.gz
Generate /usr/share/man/man1/gup-completion.1.gz
Generate /usr/share/man/man1/gup-export.1.gz
Generate /usr/share/man/man1/gup-import.1.gz
Generate /usr/share/man/man1/gup-list.1.gz
Generate /usr/share/man/man1/gup-man.1.gz
Generate /usr/share/man/man1/gup-migrate.1.gz
Generate /usr/share/man/man1/gup-remove.1.gz
Generate /usr/share/man/man1/gup-update.1.gz
Generate /usr/share/man/man1/gup-version.1.gz
Generate /usr/share/man/man1/gup.1.gz
```
### Generate shell completion file (for bash, zsh, fish, PowerShell)
`gup completion <shell>` prints a completion script to STDOUT. `--install` sets completion up for the shells of your platform.
```shell
$ gup completion bash > gup.bash
$ gup completion zsh > _gup
$ gup completion fish > gup.fish
$ gup completion powershell > gup.ps1
# Install files automatically to default user paths
$ gup completion --install
```
`--install` needs `HOME` (or `USERPROFILE` on Windows) and is safe to re-run. On Windows it sets up PowerShell; see the [install page](https://nao1215.github.io/gup/install/#shell-completion) for the paths it writes.
### Desktop notification
With `--notify`, gup shows a desktop notification when the update finishes, saying whether it succeeded.
```shell
$ gup update --notify
```


### Disable colorized output
Pass `--no-color`, or set `NO_COLOR` to a non-empty value as the [NO_COLOR](https://no-color.org/) convention describes.
```shell
$ gup update --no-color
$ NO_COLOR=1 gup update
```
## gup vs. `go tool`
Go 1.24's [`go tool`](https://go.dev/doc/modules/managing-dependencies#tools) manages tools for one project, recorded in its `go.mod` and available only inside that module. gup manages the binaries under `$GOBIN` that you run from any directory. Use `go tool` for per-project tooling and gup for your global tools.
## Feature comparison
| Feature | gup | [go-global-update](https://github.com/Gelio/go-global-update) | `go install` loop |
| --- | :-: | :-: | :-: |
| Parallel update | Yes | No | Manual |
| Per-package update channels (`latest`/`main`/`master`) | Yes | No | Manual |
| Version pinning / lock | Yes | No | Manual |
| Export/import tool set | Yes | No | Manual |
| Migrate binaries to a new `$GOBIN` | Yes | No | Manual |
| Machine-readable JSON output (`--json`) | Yes | No | No |
| Shell completion generation/install | Yes | No | No |
| `update` reinstalls up-to-date binaries | No | Yes | Yes |
| `migrate --force` reinstalls when the target already exists | Yes | No | Manual |
| Failure diagnostics / next-step hints | Yes | Yes | No |
| `NO_COLOR` support | Yes | Yes | N/A |
go-global-update and a `go install` loop update binaries one after another. [bench/README.md](./bench/README.md#comparison-suite-comparehimorimeyaml) has the time each takes to update the same 30 binaries, measured with [himorime](https://github.com/nao1215/himorime), with the machine and versions used.
## Integrations
These upgrade tools run gup. gup needs no extra setup for them.
Frequently Asked Questions
What is gup?
gup is a Package Management library for the Go programming language. Update binaries installed by "go install"
How do I install gup?
Install gup with the Go module system using `go get nao1215/gup`. Check the repository for the current installation instructions.
What category does gup belong to?
gup is listed under Package Management, specifically Package Management.