{{- $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.md)).

## 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
        ```

    === "Winget"

        ```
        winget install twpayne.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 }}
    ```

=== "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](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
    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 get.chezmoi.io)" -- init --apply $GITHUB_USERNAME
    ```

    Private GitHub repos require other
    [authentication methods](https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls):

    ```sh
    sh -c "$(curl -fsLS 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 `get.chezmoi.io/lb` or `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 Linux package

Download a package for your distribution and architecture.

=== "deb"

{{ range $arch := list "amd64" "arm64" "armel" "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" "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 }}

## 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)
    [`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" "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" "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.22 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 matches the SHA256 sum in the
verified checksum file. All the downloaded files 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-guide/releases.md).
