namitkewat/zvm.js
A simple, cross-platform Zig version manager written in pure JavaScript.
A lightweight, cross-platform solution for managing multiple Zig compiler versions
Unlike other Zig version managers written in Go or Zig, this JavaScript implementation offers:
tar
.zig-version
filesA JavaScript Runtime: You need one of the following installed:
tar
command: The script uses the system's tar
command to extract archives.
tar
is pre-installed.tar
is included with Git for Windows. Ensure Git's bin
directory is in your system PATH
.Download zvm.js
Download the zvm.js
script from this repository.
Place it in your PATH
Move the script to a directory that is part of your system's PATH
and make it executable.
For Linux & macOS:
# Download zvm
curl -fsSL https://raw.githubusercontent.com/namitkewat/zvm.js/refs/heads/main/zvm.js > /usr/local/bin/zvm
chmod +x /usr/local/bin/zvm
# Initialize zvm
zvm init
# Add to your shell profile (shown after init)
source ~/.zvm/zvm.sh
For Windows:
C:\bin
.PATH
environment variable.zvm.js
into C:\bin
and rename it to zvm.js
.zvm.cmd
in the same directory with the following content:@echo off
node "%~dp0\zvm.js" %*
Initialize zvm
Run the init
command to generate the necessary shell configuration scripts.
zvm init
This will display platform-specific instructions. Follow them to complete the setup for your shell (e.g., adding a source
command to your ~/.bashrc
or PowerShell profile).
Restart Your Shell
Close and reopen your terminal or run the provided source
command to apply the changes. zvm
is now ready to use!
# Install latest stable version
zvm install 0.14.1 --alias stable
# Use in current shell
zvm use stable
# Verify installation
zig version
# Install development build
zvm install 0.15.0-dev.1175+e4abdf5a1 --alias dev
# Switch between versions
zvm use dev
Command | Description | Example |
---|---|---|
zvm init |
Setup shell integration | zvm init |
zvm install |
Install Zig version | zvm install 0.14.1 --alias stable |
zvm use |
Activate version | zvm use stable |
zvm list |
Show installed versions | zvm list |
zvm list-remote |
Show available versions | zvm list-remote |
zvm alias |
Manage version aliases | zvm alias dev 0.15.0-dev.1175 |
zvm current |
Show active version | zvm current |
zvm uninstall |
Remove version | zvm uninstall 0.13.0 |
zvm deactivate |
Deactivate current version | zvm deactivate |
Sample Dockerfile
# Fedora-based development container
FROM public.ecr.aws/docker/library/fedora:43
# Install dependencies
RUN dnf update -y && \
dnf install -y git tar unzip nodejs && \
dnf clean all
# Install zvm
ADD https://raw.githubusercontent.com/namitkewat/zvm.js/refs/heads/main/zvm.js /usr/local/bin/zvm
RUN chmod +x /usr/local/bin/zvm
# Set up environment
RUN zvm init
ENV PATH="/root/.zvm/shims/active:${PATH}"
# Install Zig versions
ARG ZIG_STABLE=0.14.1
ARG ZIG_DEV=0.15.0-dev.1160+e43617e68
RUN zvm install $ZIG_STABLE --alias stable
RUN zvm install $ZIG_DEV --alias dev
RUN zvm use stable
# Verify installation
RUN zig version
# Default working directory
WORKDIR /app
Add a .zig-version
file to your project root:
# .zig-version
0.14.1
zvm will automatically use this version when you enter the project directory.
Windows Anti-virus Slowdown:
# If you see rename retries during install:
⚠️ Rename failed, retrying in 300ms... (1/5)
This is normal - zvm.js automatically retries operations blocked by real-time scanning.
Missing tar
on Windows:
Install Git for Windows and ensure its bin directory is in PATH
Version Management |
Available Versions |
Alias Management |
MIT License - See LICENSE for details