Skip to content

Installing ZVM

ZVM lives entirely in $HOME/.zvm on all platforms it supports. Inside of the directory, ZVM downloads Zig versions and links 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.

www.zvm.app/install.sh === ./install.sh
Terminal window
curl https://www.zvm.app/install.sh | bash
Terminal window
irm https://www.zvm.app/install.ps1 | iex
Terminal window
powershell -c "irm https://www.zvm.app/install.ps1 | iex"
Terminal window
go install -ldflags "-s -w" github.com/tristanisham/zvm@latest

Please grab the latest release.

Alternatively, you can build the app by cloning the repository and running

Terminal window
go build .
./zvm

If you want to compile ZVM without zvm upgrade, such as when packaging ZVM for a system package manager, build it with the noAutoUpgrades tag:

Terminal window
go build -tags noAutoUpgrades \
-ldflags "-s -w -X 'main.BuildUpgradeMessage=Use your package manager to upgrade ZVM.'" .

ZVM requires a few directories to be on your $PATH.

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):

Terminal window
export ZVM_INSTALL="$HOME/.zvm/self"
export PATH="$HOME/.zvm/bin:$ZVM_INSTALL:$PATH"

Then restart your shell or source the file for the changes to take effect.

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%

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.