{{- $latestRelease := gitHubLatestRelease "twpayne/chezmoi" -}}
{{- $version := $latestRelease.Name | trimPrefix "v" -}}
# Install

The latest version of chezmoi is {{ $version }} ([release notes]({{
$latestRelease.HTMLURL }}), [release history](/reference/release-history)).

## One-line package install

Install chezmoi with your package manager with a single command:

=== "Linux"

    === "Alpine"

        ```sh
        apk add chezmoi
        ```

    === "Arch"

        ```sh
        pacman -S chezmoi
        ```

    === "NixOS"

        ```sh
        nix-env -i chezmoi
        ```

    === "openSUSE Tumbleweed"

        ```sh
        zypper install chezmoi
        ```

    === "Termux"

        ```sh
        pkg install chezmoi
        ```

    === "Void"

        ```sh
        xbps-install -S chezmoi
        ```

=== "macOS"

    === "Homebrew"

        ```sh
        brew install chezmoi
        ```

    === "MacPorts"

        ```sh
        port install chezmoi
        ```

    === "Nix"

        ```sh
        nix-env -i chezmoi
        ```

=== "Windows"

    === "Chocolatey"

        ```
        choco install chezmoi
        ```

    === "Scoop"

        ```
        scoop install chezmoi
        ```

=== "FreeBSD"

    ```sh
    pkg install chezmoi
    ```

=== "OpenIndiana"

    ```sh
    pkg install application/chezmoi
    ```

chezmoi is available in many cross-platform package managers:

=== "asdf"

    ```sh
    asdf plugin add chezmoi && asdf install chezmoi {{ $version }}
    ```

=== "Linuxbrew"

    ```sh
    brew install chezmoi
    ```

=== "Nix"

    ```sh
    nix-env -i chezmoi
    ```

=== "snap"

    ```sh
    snap install chezmoi --classic
    ```

For more packages, see [chezmoi on
repology.org](https://repology.org/project/chezmoi/versions).

## One-line binary install

Install the correct binary for your operating system and architecture in `./bin`
with a single command:

=== "curl"

    ```sh
    sh -c "$(curl -fsLS get.chezmoi.io)"
    ```

=== "wget"

    ```sh
    sh -c "$(wget -qO- get.chezmoi.io)"
    ```

=== "PowerShell"

    ```powershell
    (irm -useb https://get.chezmoi.io/ps1) | powershell -c -
    ```

!!! hint

    If you already have a dotfiles repo using chezmoi on GitHub at
    `https://github.com/$GITHUB_USERNAME/dotfiles` then you can install
    chezmoi and your dotfiles with the single command:

    ```sh
    sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply $GITHUB_USERNAME
    ```

!!! hint

    To install the chezmoi binary in a different directory, use the `-b` option,
    for example:

    ```sh
    sh -c "$(curl -fsLS get.chezmoi.io)" -- -b $HOME/.local/bin
    ```

## Download a pre-built Linux package

Download a package for your distribution and architecture.

=== "deb"

{{ range $arch := list "amd64" "arm64" "armel" "i386" "mips64" "mips64le" "ppc64" "ppc64le" "riscv64" "s390x" }}
    [`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_linux_{{ $arch }}.deb)
{{- end }}

=== "rpm"

{{ range $arch := list "aarch64" "armhfp" "i686" "mips64" "mips64le" "ppc64" "ppc64le" "s390x" "riscv64" "x86_64" }}
    [`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi-{{ $version }}-{{ $arch }}.rpm)
{{- end }}

=== "apk"

{{ range $arch := list "386" "amd64" "arm" "arm64" "mips64" "mips64le" "ppc64" "ppc64le" "riscv64" "s390x" }}
    [`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_linux_{{ $arch }}.apk)
{{- end }}

## Download a pre-built binary

Download an archive for your operating system and architecture containing a
pre-built binary and shell completions.

=== "Linux"

{{ range $arch := list "amd64" "arm" "arm64" "i386" "loong64" "mips64" "mips64le" "ppc64" "ppc64le" "riscv64" "s390x" }}
    [`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_linux_{{ $arch }}.tar.gz)
{{- end }}
    [`amd64` (glibc)](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_linux-glibc_amd64.tar.gz)
    [`amd64` (musl)](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_linux-musl_amd64.tar.gz)

=== "macOS"

{{ range $arch := list "amd64" "arm64" }}
    [`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_darwin_{{ $arch }}.tar.gz)
{{- end }}

=== "Windows"

{{ range $arch := list "amd64" "arm" "arm64" "i386" }}
    [`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_windows_{{ $arch }}.zip)
{{- end }}

=== "FreeBSD"

{{ range $arch := list "amd64" "arm" "arm64" "i386" }}
    [`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_freebsd_{{ $arch }}.tar.gz)
{{- end }}

=== "OpenBSD"

{{ range $arch := list "amd64" "arm" "arm64" "i386" }}
    [`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_openbsd_{{ $arch }}.tar.gz)
{{- end }}

=== "Illumos"

    [`amd64`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_illumos_amd64.tar.gz)

=== "Solaris"

    [`amd64`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_solaris_amd64.tar.gz)

## Install from source

Download, build, and install chezmoi for your system with Go 1.18 or later:

```console
$ git clone https://github.com/twpayne/chezmoi.git
$ cd chezmoi
$ make install-from-git-working-copy
```

## Verify your download

chezmoi's release process signs the SHA256 checksums of [all released
assets](https://github.com/twpayne/chezmoi/releases/tag/v{{ $version }}) with
[cosign](https://github.com/SigStore/cosign).

To verify an asset that you have downloaded:

Download the [checksum
file](https://github.com/twpayne/chezmoi/releases/download/v{{ $version
}}/chezmoi_{{ $version }}_checksums.txt), [checksum file
signature](https://github.com/twpayne/chezmoi/releases/download/v{{ $version
}}/chezmoi_{{ $version }}_checksums.txt.sig), and [public signing
key](https://github.com/twpayne/chezmoi/releases/download/v{{ $version
}}/chezmoi_cosign.pub).

   ```console
   $ curl --location --remote-name-all \
          https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_checksums.txt \
          https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_checksums.txt.sig \
          https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_cosign.pub
   ```

Verify the signature of the checksum file with cosign.

   ```console
   $ cosign verify-blob --key=chezmoi_cosign.pub \
                        --signature=chezmoi_{{ $version }}_checksums.txt.sig \
                        chezmoi_{{ $version }}_checksums.txt
   ```

!!! important

    cosign should print `Verified OK`

Verify the that the SHA256 sum of your downloads match the SHA256 sum in the
verified checksum file. All your downloads must be in the current directory.

=== "Linux"

    ```console
    $ sha256sum --check chezmoi_{{ $version }}_checksums.txt --ignore-missing
    ```

=== "macOS"

    ```console
    $ shasum --algorithm 256 --check chezmoi_{{ $version }}_checksums.txt --ignore-missing
    ```

For more information on chezmoi's release signing process, see the [developer
documentation on chezmoi's releases](/developer/releases/).
