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 should handle this for you automatically if you're on *nix
systems, but you'll have to manually do this on Windows. You can then add
ZVM_INSTALL to your path.
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.
curl https://raw.githubusercontent.com/tristanisham/zvm/master/install.sh | bashThen add ZVM's directories to your $PATH
echo "# ZVM" >> $HOME/.profile
echo export ZVM_INSTALL="$HOME/.zvm/self" >> $HOME/.profile
echo export PATH="$PATH:$HOME/.zvm/bin" >> $HOME/.profile
echo export PATH="$PATH:$ZVM_INSTALL/" >> $HOME/.profileirm https://raw.githubusercontent.com/tristanisham/zvm/master/install.ps1 | iexpowershell -c "irm https://raw.githubusercontent.com/tristanisham/zvm/master/install.ps1 | iex"Please grab the latest release.
ZVM requires a few directories to be on your $PATH. If you don't know how to
update your environment variables perminantly 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%
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.
zvm on the Arch AUR is a community
maintained package, and may be out of date.
While Zig is still pre-1.0 if you're going to stay up-to-date with the master
branch, you're going to be downloading Zig quite often. You could do it
manually, having to scoll around to find your appropriate version, decompress
it, and install it on your $PATH. Or, you could install ZVM and run
zvm i master every time you want to update. zvm is a static binary under a
permissive license. It supports more platforms than any other Zig version
manager. Its only dependency is tar on Unix-based systems. Whether you're on
Windows, MacOS, Linux, a flavor of BSD, or Plan 9 zvm will let you install,
switch between, and run multiple versions of Zig.
zvm is stable software. Pre-v1.0.0 any breaking changes will be clearly
labeled, and any commands potentially on the chopping block will print notice.
The program is under constant development, and the author is very willing to
work with contributors. If you have any issues, ideas, or contributions you'd
like to suggest
create a GitHub issue.
zvm install <version>
# Or
zvm i <version>Use install or i to download a specific version of Zig. To install the
latest version, use "master".
# Example
zvm i masterYou can now install ZLS with your Zig download! To install ZLS with ZVM, simply
pass the -D=zls flag with zvm i. For example:
zvm i -D=zls masterzvm use <version>Use use to switch between versions of Zig.
# Example
zvm use master# Example
zvm lsUse ls to list all installed version of Zig.
zvm ls --allThe --all flag will list the available verisons of Zig for download. Not the
versions locally installed.
# Example
zvm rm 0.10.0Use uninstall or rm to remove an uninstalled version from your system.
As of zvm v0.2.3 you can now upgrade your ZVM installation from, well, zvm.
Just run:
zvm upgradeThe latest version of ZVM should install on your machine, regardless of where
your binary lives (though if you have your binary in a privaledged folder, you
may have to run this command with sudo).
# Example
zvm cleanUse clean to remove build artifacts (Good if you're on Windows).
zvm version
zvm --versionPrints the version of ZVM you have installed.
zvm help-color # Turn ANSI color printing on or off for ZVM's output, i.e. -color=true-vmu="https://validurl.local/vmu.json" # Change the source ZVM pulls Zig release information from. Good for self-hosted Zig CDNs.
# ZVM only supports schemas that match the offical version map schema.
# Run `-vmu=default` to reset your version map.
-vmu default # Resets back to default Zig releases.
-vmu mach # Sets ZVM to pull from Mach nominated Zig.