A script to manage your Zig versions.
First, make sure ZVM_BIN is on your PATH. By default, it’s ~/.local/bin:1
/home/<username>/.local/binC:\Users\<username>\.local\bin/Users/<username>/.local/binNext, determine if you need to explicitly set your target. On Linux you probably won’t have to. If you’re on Windows or MacOS, see the Cross-platform support section below.
Without any commands, zvm will print the active Zig version and exit.
Specific actions may be performed my providing a command.
listAlias: ls
List Zig versions from the remote index:
zvm list
List installed Zig versions:
zvm list -i
zvm list --installed
installAlias: i
Install a Zig version:
zvm install 0.12.0
Install a Zig version and make it active immediately:
zvm install -u 0.12.0
zvm install --use 0.12.0
useUse an installed Zig version:
zvm use 0.12.0
uninstallAlias: rm
Uninstall a Zig version:
zvm uninstall 0.11.0
By default, the uninstall command will prevent the current version from being
uninstalled. To bypass, there are 2 options:
-l,--use-latestzig command will no longer exist
and you’ll have to use the use command to select a new versionhelpAlias: h
Show zvm help:
zvm help
ZVM_HOME - zvm home directory (where zvm downloads and extracts Zig tarballs)ZVM_BIN - zvm bin directory (where zvm symlinks Zig binaries)ZVM_MIRROR - Specify a mirror to useZVM_MIRRORLIST - Specify the source for the list of mirrors zvm considers
mirrors.json from
mlugg/setup-zig$HOME/.local/share/zvm)
$HOME/.local/bin/zig)
Native support. zvm’s detected native target will likely work, but you can
override it if you need to.
Supported via various Linux subsystems (git-bash, WSL, etc.).
zvm uses uname to detect the target and it currently only uses what uname
provides, which will differ depending on the Linux subsystem used (git-bash,
WSL, mingw, etc). However, Zig’s
targets use
windows as the OS name. Due to this, for now you’ll have to explicitly set
your target:
zvm --target <arch>-windows
Replace <arch> with one of the following:
x86 (e.g. x86-windows)x86-64 (e.g. x86_64-windows)aarch64-windows)Supported natively but shares the same gotchas as the Windows support.
zvm uses uname to detect the target and it currently only uses what uname
provides. However, Zig’s
targets use
macos as the OS name instead of darwin, which is what uname will return.
Due to this, for now you’ll have to explicitly set your target:
zvm --target <arch>-macos
Replace <arch> with one of the following:
x86-64 (e.g. x86_64-macos)aarch64 (e.g.
aarch64-macos)You can override this path with the ZVM_BIN environment variable. See
the Environment section for details. ↩