Install
Prebuilt binaries
Section titled “Prebuilt binaries”Every tagged release publishes a static binary for six targets, alongside a
SHA256SUMS file:
| Platform | Target |
|---|---|
| Linux | x86_64-linux-musl, aarch64-linux-musl |
| macOS | x86_64-macos, aarch64-macos |
| Windows | x86_64-windows, aarch64-windows |
Download from the releases page,
extract, and put the binary on your PATH. Linux builds link musl statically,
so there is no glibc version to match.
From source
Section titled “From source”-
Install Zig 0.16.0
zpack uses the
std.Iointerfaces introduced in 0.16, so it will not build on 0.15 or earlier. Get it from ziglang.org or a package manager.Repository Command winget winget install zig.zigChocolatey choco install zigScoop scoop install zigDistribution Command Arch Linux pacman -S zigAlpine apk add zigAny snap install zig --betaDistro packages lag behind. If yours ships an older Zig, take a release tarball from ziglang.org instead.
-
Clone and build
Terminal window git clone https://github.com/masonschafercodes/zpackcd zpackzig build -Doptimize=ReleaseFastThe executable lands in
zig-out/bin/zpack. -
Add it to your
PATHoptionalTerminal window $env:PATH += ";$PWD\zig-out\bin"To persist it, add the directory under System Properties → Environment Variables.
Append to
~/.zshrc:Terminal window export PATH="$PATH:/path/to/zpack/zig-out/bin"Append to
~/.bashrcor~/.zshrc:Terminal window export PATH="$PATH:/path/to/zpack/zig-out/bin"
Other build targets
Section titled “Other build targets”| Command | Does |
|---|---|
zig build |
Debug build with symbols |
zig build -Doptimize=ReleaseFast |
Optimized, no safety checks |
zig build -Dstrip |
Omit debug symbols |
zig build -Dtarget=aarch64-macos |
Cross-compile; no extra toolchain needed |
zig build test |
Run the test suite and build every example |
zig build run -- list game.zpak |
Run without installing |
zig build examples |
Build the four examples without running them |
As a library
Section titled “As a library”To depend on zpack from another Zig project rather than installing the CLI, see the library overview.