---
title: "alpacon update"
description: "Update the Alpacon CLI to the latest release or check for one. Learn how package manager installs are handled, what permissions it needs, and its exit codes."
---

> Full documentation index: https://docs.alpacax.com/llms.txt

# alpacon update

Update the CLI to the latest release.

## Usage

`alpacon update [flags]`

## Key facts

- A binary you installed yourself, including with the Windows install script, is replaced in place.
- When a newer release exists, a binary installed by Homebrew, a deb or rpm package, mise, or asdf is left alone; the command prints how to update it through that tool and exits with code `1`.
- `--check` installs nothing and exits with code `8` when a newer release exists.
- A build newer than the latest release, such as a release candidate, is never downgraded.

## Flags

| Flag | Type | Description | Default |
| --- | --- | --- | --- |
| `--check` | `bool` | Report whether a newer release exists without installing it | `false` |
| `-h, --help` | `bool` | help for update | `false` |
| `--output` | `string` | Output format: table or json | `table` |

## Examples

Update to the latest release

```bash
alpacon update
```

Check for a newer release without installing it

```bash
alpacon update --check
```

## How the update works

The command reads the latest release of [alpacon-cli on GitHub](https://github.com/alpacax/alpacon-cli/releases) and compares it with the installed version. If you are already on it, it prints `alpacon <version> is already up to date.` and exits with code `0`.

Otherwise it downloads the archive for your operating system and architecture, verifies it against the SHA-256 checksums file published with the same release, and replaces the binary. The old binary is kept until the replacement succeeds. On success it prints `Successfully updated to <version>.`

On Windows, the replaced `alpacon.exe` stays in the install folder as `alpacon.exe.old.<timestamp>` until the next `alpacon update` removes it.

While it runs, the command holds a `.alpacon-update.lock` file next to the binary so two updates cannot replace the same file at once. The file stays after the update and is safe to leave.

## Package manager installs

A binary that another tool installed is updated through that tool, so its package database stays correct. When a newer release exists, the command prints what to run and exits with code `1` without changing anything:

| Installed with | Update with |
| --- | --- |
| Homebrew | `brew upgrade alpacon-cli` |
| deb package | `sudo apt-get update && sudo apt-get install --only-upgrade alpacon` |
| rpm package | `sudo yum update alpacon` |
| mise or asdf | Update through that tool |

If the command cannot tell whether a package owns the binary, for example while another package transaction is running, it leaves the binary alone. Try again once that transaction finishes, or update through your package manager.

A binary built from source reports the version `dev`, which matches no release, so `alpacon update` refuses it. Install a released build to use the command.

## Permissions

The user who runs the command must be able to write to the folder that holds the binary. If not, the command stops with `The install location is not writable by this user.` Run `sudo alpacon update` on Linux and macOS, or run `alpacon update` from an administrator terminal on Windows. The Windows install script places the binary in your own `%LOCALAPPDATA%\Alpacon\bin`, so it needs no administrator rights.

If the temporary directory is not writable, point `TMPDIR` (on Windows, `TMP`) at a writable directory and try again.

## Check for updates

`alpacon update --check` reports whether a newer release exists and installs nothing, so a script can branch on the exit code without reading the message:

- 0: already on the latest release.
- 8: a newer release exists. The command also prints what to run: `alpacon update` for a binary you installed yourself, or the package manager command from the table above.
- 1: the check itself failed, for example because the release could not be fetched.

To read the latest version in a script instead, use [`alpacon version --output json`](/reference/cli/version/#json-output).

## Exit codes

- 0: the CLI was updated or is already on the latest release.
- 1: the update failed, a newer release exists but the binary belongs to a package manager or version manager, or the build is a `dev` build.
- 8: `--check` only. A newer release exists.

## Related

- [alpacon version](/reference/cli/version/)
- [Install the CLI](/learn/tutorials/cli/)

Source: https://docs.alpacax.com/reference/cli/update/
