As a full-stack engineer, we often install various tools on the same computer. However, due to different requirements, we may need to use different versions of these tools, making version management extremely important.
We use nvm to manage Node.js;
We use gvm to manage Go (Golang);
We use pyenv or Conda to manage Python.
These tools are all very powerful, but their usage differs significantly. After a period of not using them, we have to re-familiarize ourselves with how each one works. More importantly, this adds several extra pieces of software to our system for no apparent reason.
After reinstalling my system one time, I finally reached my breaking point… In reality, my needs are simple, and I don’t require the advanced features of these version managers. I just need a lightweight version manager with a unified management approach and consistent commands.
Thus, xvm was born—a version management tool that integrates support for Node.js, Go, Python, and more. While it may not be as powerful as specialized tools, it’s compact and offers a uniform command structure.
xvm is a version management tool for Linux and macOS, while on Windows, you can use xvm-windows.
Installation
curl -o- https://raw.githubusercontent.com/duan0120/xvm/main/install.sh | bash
or
git clone https://github.com/duan0120/xvm.git ~/.xvm
Add the following code to ~/.bashrc or ~/.zshrc, and source it again:
export XVM_ROOT=~/.xvm
[ -s "$XVM_ROOT/xvm" ] && source "$XVM_ROOT/xvm"
Usage
Check version
xvm -v
Get help
xvm -h
xvm help node
Node.js
List available versions
xvm node ls-remote
xvm node ls-remote --lts
xvm node list
Install specific version
xvm node install v18.19.1
# Install the specified version and set it as the default.
xvm node install v18.19.1 --default
Uninstall specific version
xvm node uninstall v18.19.1
Switch version
xvm node use v18.19.1
# switch to the specified version and set it as the default
xvm node use v18.19.1 --default
Check default version
xvm node default
Go
List available versions
xvm go ls-remote
xvm go list
Install specific version
xvm go install go1.19.2
xvm go install go1.19.2 --default
# arch: amd64/arm64/386 and the default arch is amd64
xvm go install go1.13.10 --default --arch=amd64
Uninstall specific version
xvm go uninstall go1.19.2
Switch version
xvm go use go1.19.2
# switch to the specified version and set it as the default
xvm go use go1.19.2 --default
Check default version
xvm go default
Python
Install dependencies Source code compilation installation, please refer to https://devguide.python.org/getting-started/setup-building/
Check version
xvm python ls-remote
xvm python list
Install specific version
xvm python install 3.12.0
# Install the specified version and set it as the default.
xvm python install 3.12.0 --default
Switch version
xvm python use 3.12.0
# switch to the specified version and set it as the default
xvm python use 3.12.0 --default
Check default version
xvm python default
Create virtual environment
xvm python alias 3.12.0 venv
Activate virtual environment
xvm python activate venv
Deactivate virtual environment
xvm python deactivate
Uninstall specific version
xvm python uninstall 3.12.0
# remove the virtual environment
xvm python uninstall venv