hendriknielaender/zvm
⚡ Fast and simple zig version manager (zvm)
zvm
)
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
or zvm 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
or zvm install
Installs the specified version of Zig or zls. Zig is the default if no tool is specified.
zvm install <version> # Installs Zig for the specified version (default)
zvm install <version> --debug # Installs with debug output
zvm install --mirror=0 # Installs Zig with a specified mirror url
zvm install zig <version> # Installs only Zig for the specified version (explicit)
zvm install zls <version> # Installs only zls for the specified version
zvm use
Switches to using the specified installed version of Zig or zls. Zig is the default if no tool is specified.
zvm use <version> # Use this version of Zig (default)
zvm use zig <version> # Use this version of Zig (explicit)
zvm use zls <version> # Use this version of zls only
zvm remove
Removes the specified installed version of Zig or ZLS. Zig is the default if no tool is specified.
zvm remove <version> # Removes this version of Zig (default)
zvm remove zig <version> # Removes only the specified Zig version (explicit)
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
# List of available Zig mirrors
zvm ls --mirror
# Install Zig version 0.14.1 (zig is default)
zvm install 0.14.1
# Install Zig version 0.14.1 with debug output
zvm install 0.14.1 --debug
# Install zls version 0.14.0
zvm install zls 0.14.0
# Use Zig version 0.14.1 (zig is default)
zvm use 0.14.1
# Remove Zig version 0.14.1 (zig is default)
zvm remove 0.14.1
# 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.14.1.
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.