Skip to content

Switch Versions

Terminal window
zvm use <version>

Use use to switch between versions of Zig. By default, this changes the global selection. With per-shell setup, it changes only the current shell. Pass --global (or -g) to change the global default explicitly:

Terminal window
zvm use --global 0.15.2

In a configured shell, changing the global default leaves that shell’s own selection in place.

Terminal window
# Examples
zvm use master
zvm use stable # highest non-dev, non-master release
zvm use 0.13 # shorthand; resolves to an installed 0.13.x

use resolves shorthand against versions already installed on your machine. If the requested version is missing, it prompts to install it. For scripts, install it first with zvm i. See Version Syntax for the full list of accepted forms.

When called without a version, zvm use reads .minimum_zig_version from the current project’s build.zig.zon:

Terminal window
zvm use

You can also place a ZVM lock directive in build.zig and apply it with --sync:

0.14.1
Terminal window
zvm use --sync

Both forms switch the active Zig symlink, just like an explicit zvm use <version>.

For automatic switching when entering a project, set up zvm env --use-on-cd. That hook also searches parent directories for a version declaration.

Link the directory containing your built zig executable into the ZVM data directory under a name of your choice:

Terminal window
ln -s "$HOME/src/zig/zig-out/bin" "$HOME/.zvm/local"
zvm use local
zvm run local version

Use $ZVM_PATH/local instead if you configured a custom data directory. On Windows, the linked directory must contain zig.exe.

ZVM treats the link as an installed version. zvm uninstall refuses to remove linked builds, and zvm dedupe skips their files. Remove the link yourself when you no longer need it.