Skip to content

Environment Variables

Wesley Koerber edited this page Jan 1, 2025 · 3 revisions

Overview

Variable Default Description
ZVM_HOME $HOME/.local/share/zvm The path where zvm stores installed Zig versions.
ZVM_BIN $HOME/.local/bin The path where zvm puts symlinks to the active Zig version.
ZVM_MIRROR N/A The mirror zvm uses to fetch the index, download tarballs, etc. If not specified, zvm will choose a mirror at random from the ZVM_MIRRORLIST file.
ZVM_MIRRORLIST mlugg/setup-zig mirrors.json The list of mirrors zvm will consider. See the Mirror list section for details.

Multi-user installation

To install Zig versions for multiple users, you should set ZVM_HOME and ZVM_BIN to a path that is accessible to all users. For example:

ZVM_HOME=/usr/local/share/zvm \
ZVM_BIN=/usr/local/bin \
zvm i -u master

Mirror list

zvm uses a a mirror list file that contains available mirrors. By default, this list is sourced from mirrors.json in the mlugg/setup-zig repo.

The mirror list is fetched via cURL and saved to $ZVM_HOME/mirrors.json. Because this is fetched via cURL, the mirror list can be sourced from a local file. For example, if you want to add an entry to the mirror list, you can download the mirrors.json file manually, add the entry, and tell zvm to use this file as the mirror list:

mkdir -p ~/.config/zvm && \
curl -s https://raw.githubusercontent.com/mlugg/setup-zig/refs/heads/main/mirrors.json |
jq --arg url 'https://mirror.weskoerber.com/zig' --arg owner 'Wes Koerber <wes@weskoerber.com>' '.+=[[$url,$owner]]' \
> ~/.config/zvm/custom_mirrors.json

Then, you can tell zvm to use this mirror list:

ZVM_MIRRORLIST=~/.config/zvm/custom_mirrorlist.json zvm ls
Clone this wiki locally