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

The latest version of chezmoi is {{ $version }} ([release notes][notes],
[release history][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
        ```

    === "Debian"

        ```sh
        apt-get install chezmoi
        ```

    === "Fedora"

        ```sh
        dnf install chezmoi
        ```

    === "NixOS"

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

    === "openSUSE Tumbleweed"

        ```sh
        zypper install chezmoi
        ```

    === "RHEL (EPEL)"

        ```sh
        dnf install epel-release && dnf 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"

        ```batch
        choco install chezmoi
        ```

    === "Scoop"

        ```batch
        scoop install chezmoi
        ```

    === "Winget"

        ```batch
        winget install twpayne.chezmoi
        ```

=== "FreeBSD"

    ```sh
    pkg install chezmoi
    ```

=== "OpenIndiana"

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

chezmoi is available in many cross-platform package managers:

=== "am"

    ```sh
    am -i chezmoi
    ```

=== "asdf"

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

=== "mise"

    ```sh
    mise use --global chezmoi@{{ $version }}
    ```

=== "Homebrew"

    ```sh
    brew install chezmoi
    ```

=== "Nix"

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

=== "snap"

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

For more packages, see [chezmoi on repology.org][repology].

## 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 https://get.chezmoi.io)"
    ```

=== "wget"

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

=== "PowerShell"

    ```powershell
    iex "&{$(irm 'https://get.chezmoi.io/ps1')}"
    ```

    To provide the script with arguments, place them at the end of the quote:

    ```powershell
    iex "&{$(irm 'https://get.chezmoi.io/ps1')} -b '~/bin'"
    ```

!!! 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 https://get.chezmoi.io)" -- init --apply $GITHUB_USERNAME
    ```

    Private GitHub repos require other [authentication methods][https-clone]:

    ```sh
    sh -c "$(curl -fsLS https://get.chezmoi.io)" -- init --apply git@github.com:$GITHUB_USERNAME/dotfiles.git
    ```

!!! hint

    If you want to install chezmoi in `./.local/bin` instead of `./bin` you can
    use `https://get.chezmoi.io/lb` or `https://chezmoi.io/getlb` instead.

!!! 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 package

Download a package for your distribution and architecture.

=== "deb"
{{ range $arch := list "amd64" "arm64" "armel" "armhf" "i386" "loong64" "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" "armv5l" "i686" "loong64" "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" "loong64" "mips64_hardfloat" "mips64le_hardfloat" "ppc64" "ppc64le" "riscv64" "s390x" }}
    [`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_linux_{{ $arch }}.apk)
{{- end }}

=== "Arch Linux"
{{ range $arch := list "386" "amd64" "arm" "arm64" "loong64" "mips64_hardfloat" "mips64le_hardfloat" "ppc64" "ppc64le" "riscv64" "s390x" }}
    [`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_linux_{{ $arch }}.pkg.tar.zst)
{{- end }}

=== "Windows"
{{ range $arch := list "386" "amd64" "arm64" }}
    [`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_windows_{{ $arch }}.msix)
{{- 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" "arm64" "armv5" "armv6" "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)
    [`arm64` (Termux)](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_android_arm64.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" "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" "riscv64" }}
    [`{{ $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" "ppc64" "riscv64" }}
    [`{{ $arch }}`](https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_{{ $version }}_openbsd_{{ $arch }}.tar.gz)
{{- end }}

## Install from source

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

```sh
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][release-assets] with [cosign][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.sigstore.json), and [public signing
key](https://github.com/twpayne/chezmoi/releases/download/v{{ $version
}}/chezmoi_cosign.pub).

   ```sh
   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.sigstore.json \
          https://github.com/twpayne/chezmoi/releases/download/v{{ $version }}/chezmoi_cosign.pub
   ```

Verify the signature of the checksum file with cosign.

   ```sh
   cosign verify-blob --key=chezmoi_cosign.pub \
                        --bundle=chezmoi_{{ $version }}_checksums.txt.sigstore.json \
                        chezmoi_{{ $version }}_checksums.txt
   ```

!!! important

    cosign should print `Verified OK`

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

=== "Linux"

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

=== "macOS"

    ```sh
    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-release].

[history]: /reference/release-history.md
[notes]: {{ $latestRelease.HTMLURL }}
[repology]: https://repology.org/project/chezmoi/versions
[https-clone]: https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls
[release-assets]: https://github.com/twpayne/chezmoi/releases/tag/v{{ $version }}
[cosign]: https://github.com/SigStore/cosign
[developer-release]: /developer-guide/releases.md
