zvm is a command-line tool that allows you to easily install, manage, and switch between multiple versions of Zig.
- List available Zig/zls versions (both remote and local).
- Install specific Zig or zls versions.
- Switch between installed Zig or zls versions.
- Remove installed Zig or zls versions.
- Display the current zvm version and helpful usage information.
To install zvm with Homebrew, aka. brew
, run the following commands:
brew tap hendriknielaender/zvm
brew install zvm
Now add this line to your ~/.bashrc
, ~/.profile
, or ~/.zshrc
file.
export PATH="$HOME/.zm/current/zig:$PATH"
irm https://raw.githubusercontent.com/hendriknielaender/zvm/master/install.ps1 | iex
powershell -c "irm https://raw.githubusercontent.com/hendriknielaender/zvm/master/install.ps1 | iex"
zvm
provides built-in shell completion scripts for both Zsh and Bash. This enhances the command-line experience by allowing tab-completion of subcommands, flags, etc.
Generate the Zsh completion script:
zvm completions zsh > _zvm
Move _zvm
into a directory that Zsh checks for autoloaded completion scripts. For example:
mkdir -p ~/.zsh/completions
mv _zvm ~/.zsh/completions
Add this to your ~/.zshrc
:
fpath+=(~/.zsh/completions)
autoload -U compinit && compinit
Reload your shell:
source ~/.zshrc
Generate the Bash completion script:
zvm completions bash > zvm.bash
Source it in your ~/.bashrc
(or ~/.bash_profile
):
echo "source $(pwd)/zvm.bash" >> ~/.bashrc
source ~/.bashrc
General Syntax:
zvm <command> [arguments]
Available Commands:
-
zvm ls
orzvm list
Lists all available versions of Zig or zls remotely by default.
Use--system
to list only locally installed versions.zvm ls zvm ls --system zvm ls zls --system
-
zvm i
orzvm install
Installs the specified version of Zig or zls.zvm install <version> # Installs Zig and zls for the specified version zvm install zig <version> # Installs only Zig for the specified version zvm install zls <version> # Installs only zls for the specified version
-
zvm use
Switches to using the specified installed version of Zig or zls.zvm use <version> # Use this version of Zig and zls if installed zvm use zig <version> # Use this version of Zig only zvm use zls <version> # Use this version of zls only
-
zvm remove
Removes the specified installed version of Zig or ZLS.zvm remove <version> # Removes this version of Zig and/or zls if installed zvm remove zig <version> # Removes only the specified Zig version zvm remove zls <version> # Removes only the specified zls version
-
zvm clean
Remove old download artifacts. -
zvm --version
Displays the current version of zvm. -
zvm --help
Displays detailed usage information.
Examples:
# List all available remote Zig versions
zvm ls
# List all installed local Zig versions
zvm ls --system
# List all installed local zls versions
zvm ls zls --system
# Install Zig version 0.12.0
zvm install 0.12.0
# Use Zig version 0.12.0
zvm use zig 0.12.0
# Remove Zig version 0.12.0
zvm remove zig 0.12.0
# Remove old download artifacts.
zvm clean
Zig is in active development and the APIs can change frequently, making it challenging to support every dev build. This project currently aims to be compatible with stable, non-development builds to provide a consistent experience for the users.
Supported Version: As of now, zvm is tested and supported on Zig version 0.13.0.
Contributions, issues, and feature requests are welcome!
Please note that our project is not affiliated with ZVM maintained by @tristanisham. Both projects operate independently, and any similarities are coincidental.