kache 1.2.1

Compiler cache for Rust, C/C++ and CUDA, with S3, GCS, shared-filesystem and OCI remotes.
---
title: Installation
description: Install Kache from a release, package manager, crates.io, or Nix
---

```bash
cargo install kache --locked
kache init
```

`kache init` configures Cargo to use Kache. Your Cargo commands stay the same.

## Recommended methods

<Tabs items={["cargo install", "cargo-binstall"]}>
  <Tab value="cargo install">
    ```bash
    cargo install kache --locked
    ```

    Cargo builds Kache with your local Rust toolchain, which must be Rust 1.95 or newer.
  </Tab>
  <Tab value="cargo-binstall">
    ```bash
    cargo binstall kache
    ```

    This downloads a release binary when one exists for your target. Release binaries have no Rust runtime dependency.
  </Tab>
</Tabs>

## Package managers

<Tabs items={["Homebrew", "APT", "Windows", "AUR", "mise"]}>
  <Tab value="Homebrew">
    ```bash
    brew install kunobi-ninja/kunobi/kache
    ```

    Use `kunobi-ninja/kunobi/kache-unstable` for release candidates and betas.
  </Tab>
  <Tab value="APT">
    ```bash
    sudo mkdir -p /etc/apt/keyrings
    curl -fsSL https://r2.kunobi.com/kache/apt/gpg.key \
      | sudo gpg --dearmor -o /etc/apt/keyrings/kache.gpg
    echo "deb [signed-by=/etc/apt/keyrings/kache.gpg] https://r2.kunobi.com/kache/apt stable main" \
      | sudo tee /etc/apt/sources.list.d/kache.list
    sudo apt update
    sudo apt install kache
    ```

    Replace `stable` with `unstable` to receive prereleases as well as stable releases.

    The package also installs Cargo and compiler shims in `/usr/lib/kache`. Prepend that directory to `PATH` to cache Make and CMake object compiles. See [C and C++](/docs/getting-started/c-cpp).
  </Tab>
  <Tab value="Windows">
    ```powershell
    winget install kunobi-ninja.kache
    # or
    scoop bucket add kunobi https://github.com/kunobi-ninja/scoop-kunobi
    scoop install kunobi/kache
    # or
    choco install kache
    ```

    The corresponding prerelease packages are `kunobi-ninja.kache.Unstable`, `kunobi/kache-unstable`, and `choco install kache --pre`.
  </Tab>
  <Tab value="AUR">
    ```bash
    paru -S kache-bin
    ```

    `kache-bin` is the official prebuilt package. `kache-git` builds the current main branch; the community `kache` package builds a release from source.

    Both official packages install Cargo and compiler shims in `/usr/lib/kache`. For `makepkg`, put `PATH="/usr/lib/kache:$PATH"` in `~/.makepkg.conf`.
  </Tab>
  <Tab value="mise">
    ```bash
    mise use -g github:kunobi-ninja/kache@latest
    ```

    Release candidates do not resolve as `latest`. Request their full `x.y.z-rc.n` version explicitly.
  </Tab>
</Tabs>

## Nix

The flake builds for x86_64-linux, aarch64-linux and aarch64-darwin. On Intel macOS, use Homebrew, a release binary or `cargo install`.

The `stable` branch follows released versions:

```bash
nix run github:kunobi-ninja/kache/stable -- --version
nix profile install github:kunobi-ninja/kache/stable
```

Pin a release tag when updates must be explicit:

```bash
nix profile install github:kunobi-ninja/kache/v1.0.0
```

The flake also exports `overlays.default`, `nixosModules.default` and `darwinModules.default`. The module's `services.kache` options are defined in [`packaging/nix/module.nix`](https://github.com/kunobi-ninja/kache/blob/main/packaging/nix/module.nix). `enable` installs Kache, writes `settings` to `/etc/kache/config.toml` and sets `KACHE_CONFIG`. `rustcWrapper`, on by default, sets `RUSTC_WRAPPER`. `daemon.enable` runs the daemon as a systemd or launchd user service. The module does not put the shims on `PATH`; use the example below for that.

The package includes `cargo`, `cc`, `c++`, `gcc`, `g++`, `clang`, `clang++`, and `rustdoc` symlinks in `${kache}/shims`. With this flake's `overlays.default` applied, enable them in your NixOS configuration:

```nix
{ pkgs, ... }:
{
  environment.systemPackages = [ pkgs.kache ];
  environment.sessionVariables = {
    RUSTC_WRAPPER = "${pkgs.kache}/bin/kache";
    PATH = [ "${pkgs.kache}/shims" ];
  };
}
```

Keep the real compilers later in `PATH`. The compiler shims cover C and C++; Rust still uses `RUSTC_WRAPPER`. Point `build.rustdoc` at the `rustdoc` link for the [supported rustdoc mode](/docs/getting-started/rustdoc). Plain `cargo doc` passes through. The Cargo shim protects targets while Cargo commands run. Nix builds the symlinks, so no `kache init --shims` step is needed. The existing `${kache}/lib/kache` path remains available.

## Supported release targets

| Platform | Architectures |
| --- | --- |
| Linux, musl | x86_64, aarch64 |
| macOS | x86_64, Apple silicon |
| Windows, MSVC | x86_64, ARM64 |

Other Rust-supported targets may work through `cargo install`, but they are not release-tested targets.

## Shell completions

The official AUR packages install completions for Bash, Zsh, Fish and Elvish. For other installs, generate a script with [`kache completions <shell>`](/docs/commands/reference#kache-completions) and save it where your shell loads completions.

## Verify the install

```bash
kache --version
kache doctor
```

If you have not run it yet, enable Kache with `kache init`. The [quick start](/docs/getting-started/quick-start) shows how to confirm cache hits.

<video src="https://raw.githubusercontent.com/kunobi-ninja/kache/main/assets/init.webm" aria-label="kache init previewing its changes, applying them, and kache doctor passing every check" autoPlay loop muted playsInline controls />

## Build from source

```bash
git clone https://github.com/kunobi-ninja/kache
cd kache
cargo install --path . --locked
```

A git checkout builds with the toolchain pinned in `rust-toolchain.toml`, which rustup installs on first use.