Install, pin, and switch Zig toolchains with zvm (Zig Version Manager). Teaches agents zvm's real command surface and how to select a Zig version without disturbing the user's global install.
Zig Version Manager (zvm) is a tool for managing your
Zig installs. With std under heavy development and a
large feature roadmap, Zig is bound to continue changing. Breaking existing
builds, updating valid syntax, and introducing new features like a package
manager. While this is great for developers, it also can lead to headaches when
you need multiple versions of a language installed to compile your projects, or
a language gets updated frequently.
ZVM lives entirely in $HOME/.zvm on all platforms it supports. Inside of the
directory, ZVM will download new Zig versions and symlink whichever version you
specify with zvm use to $HOME/.zvm/bin. You should add this folder to your
path. After ZVM 0.2.3, ZVM's installer will now add ZVM to $HOME/.zvm/self.
You should also add this directory as the environment variable ZVM_INSTALL.
The installer scripts should handle this for you automatically on *nix and
Windows systems.
If you don't want to use ZVM_INSTALL (like you already have ZVM in a place you
like), then ZVM will update the exact executable you've called upgrade from.
All installation scripts hosted on www.zvm.app are identical to, and are
automatically synced with their respective copies on GitHub.
Releases are built by GitHub Actions, which publishes a SHA256SUMS file and a
signed build provenance attestation
for every archive. To check that an archive is exactly what CI built from this
repository:
gh attestation verify zvm-linux-amd64.tar --repo tristanisham/zvm
# or, without the GitHub CLI, just the checksum:
sha256sum --check --ignore-missing SHA256SUMS
This covers releases built by the workflow, starting after v0.9.3. The install
scripts and zvm upgrade don't check it yet.
Alternatively, you can build the app by cloning the repository and running
go build .
./zvm
If you want to disable that ZVM can automatically update itself, you can run
go build -tags noAutoUpgrades .
instead for building the app.
Putting ZVM on your Path
ZVM requires a few directories to be on your $PATH.
Linux, BSD, MacOS, *nix
The installer script handles this for you automatically. If you need to set it
up manually, append the following to your shell's startup file (~/.bashrc,
~/.zshrc, or ~/.profile):
Then restart your shell or source the file for the changes to take effect.
Windows
If you don't know how to update your environment variables permanently on
Windows, you can follow
this guide. Once you're in
the appropriate menu, add or append to the following environment variables:
Add
ZVM_INSTALL: %USERPROFILE%\.zvm\self
Append
PATH: %USERPROFILE%\.zvm\bin
PATH: %ZVM_INSTALL%
Configure ZVM path
It is possible to overwrite the default behavior of ZVM to adhere to XDG
specification on Linux. There's an environment variable ZVM_PATH. Setting it
to $XDG_DATA_HOME/zvm will do the trick.
Community Package
AUR
zvm on the Arch AUR is a
community-maintained package, and may be out of date.