weskoerber/zvm
Zig Version Manager - POSIX-compliant shell script to manage multiple active Zig versions.
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/bin
C:\Users\<username>\.local\bin
/Users/<username>/.local/bin
Next, 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.
list
Alias: ls
List Zig versions from the remote index:
zvm list
List installed Zig versions:
zvm list -i
zvm list --installed
install
Alias: 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
use
Use an installed Zig version:
zvm use 0.12.0
uninstall
Alias: 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-latest
zig
command will no longer exist
and you'll have to use the use
command to select a new versionhelp
Alias: 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
considersmirrors.json
from
mlugg/setup-zig
Support building from source? (in-progress, see #14)
Allow custom download location (default: $HOME/.local/share/zvm
)
- 9b1afd4
Allow custom install prefix (default: $HOME/.local/bin/zig
)
- 9b1afd4
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
)[^1]: You can override this path with the ZVM_BIN
environment variable. See
the Environment section for details.