# Install snapdir for Zig
The Zig binding is a thin `@cImport` wrapper over the snapdir **C ABI**, which
wraps the canonical Rust core — so you get the same BLAKE3 walk, manifests, and
64-character snapshot IDs as the CLI. There is no Zig package registry blob for
the native library, so you build it from the published `snapdir-ffi` source
crate and `zig fetch --save` the wrapper.
## Install
The Zig binding is **build-from-source**: it links the native snapdir FFI static
library. You need a **Rust toolchain**, **cbindgen**, and **Zig 0.13.0**. First
build the C ABI from the [`snapdir-ffi`](https://crates.io/crates/snapdir-ffi)
crate and generate its header (the crate ships no header, so run `cbindgen`),
placing both in `include/` and `lib/`:
```sh
# needs a Rust toolchain + cbindgen; on Alpine also: apk add libgcc
cargo build --release # -> libsnapdir_ffi.a
cbindgen --config cbindgen.toml --crate snapdir-ffi --output include/snapdir.h .
```
Then add the Zig wrapper to your project and import it from `build.zig`:
```sh
zig fetch --save git+https://github.com/snapdir/snapdir#
```
```zig
// consumer build.zig
const snapdir_dep = b.dependency("snapdir", .{ .target = target, .optimize = optimize });
exe.root_module.addImport("snapdir", snapdir_dep.module("snapdir"));
// + link the vendored libsnapdir_ffi.a (see the build.zig NOTE).
```
Because the static library is built for one CPU arch, `build.zig` links it with
the matching target. On **Alpine/musl** the Rust staticlib links `libgcc_s`,
which Alpine ships only as the versioned `libgcc_s.so.1`, so run
`ln -sf /usr/lib/libgcc_s.so.1 /usr/lib/libgcc_s.so` and build **native** (no
`-Dtarget`, since the container is already the musl target).
## Platform support
Every binding runs on Linux (glibc and Alpine/musl, x64 and arm64) and macOS;
Windows is unsupported, since snapdir is Unix-only.
| Platform | Supported |
| --- | --- |
| Linux glibc (x64 + arm64) | yes |
| Linux musl / Alpine (x64 + arm64) | yes |
| macOS | yes |
| Windows | no |
The one binding-wide exception is **Java**, which is glibc-only today (musl
support is planned for 1.11.1). The Zig binding has no such caveat — it links on
glibc and musl alike.
## Next
- [Zig quickstart](/quickstart/zig/) — a 60-second push → pull round-trip.
- [snapdir for Zig](/bindings/zig/) — the full binding reference.