How anyzig manages Zig versions
masteranyzig acts as a universal wrapper for the zig executable, allowing you to use multiple Zig versions without changing your PATH. It determines which version to run using the following priority:
- Explicit Argument: If you provide a version string as the first argument to the
zigcommand, anyzig will use that version. - Mach Version Config: If your
build.zig.zoncontains a.mach_zig_versionproperty, anyzig uses that version. - Minimum Zig Version: If no explicit argument or Mach config is found, anyzig searches the current or parent directories for a
build.zig.zonfile and uses the value of theminimum_zig_versionfield.
When a required version is not found locally, anyzig automatically performs the equivalent of zig fetch ZIG_DOWNLOAD_URL to download the compiler into a global cache.
# Using an explicit version argument
$ zig 0.13.0 build-exe myproject.zig
# Using a specific dev version
$ zig 0.14.0-dev.3028+cdc9d65b0 build-exe mynewerproject.zig