dev-resources.site
for different kinds of informations.
Switching between multiple versions of various tools
I'm sure you've worked on different projects that used different versions of tools despite having the same technology stack. Whether you work as a frontend dev, backend dev, or DevOps, this problem can happen anywhere. Switching between versions of various tools can be tricky and painful. In this article, I decided to put together tools that will help reduce this pain.
I googled how to do it whenever I needed to switch between versions. This article I'll treat as a private cheat sheet. If you use the following tools on a daily basis, I encourage you to save this post and treat it as I do.
Switching Terraform version - tfenv
Installation
# Mac OS
brew install tfenv
Basic commands
# list all installed terraform versions
tfenv list
# list all available terraform versions for installation
tfenv list-remote
# install selected terraform version
tfenv install 1.3.6
# switch to installed terraform version
tfenv use 1.3.6
# print currently set terraform version
tfenv version-name
# uninstall selected terraform version
tfenv uninstall 1.0.11
Switching Java, Maven, and Gradle version - sdkman
Installation
curl -s https://get.sdkman.io | bash
source ~/.bash_profile
Basic commands
# list all installed and installable versions
sdk list java
sdk list maven
sdk list gradle
# install selected version
sdk install java 17.0.5-zulu
sdk install maven 3.8.6
sdk install gradle 7.6
# switch to installed version
sdk use java 17.0.5-zulu
sdk use maven 3.8.6
sdk use gradle 7.6
# print currently set version
sdk current java
sdk current maven
sdk current gradle
# uninstall selected version
sdk uninstall java 8.0.352-zulu
sdk uninstall maven 3.6.0
sdk uninstall gradle 7.4
# list all tools whose versions sdkman can manage
sdk list
Switching Node & npm version - nvm
Installation
# Mac OS
brew install nvm
mkdir ~/.nvm
# support for Oh My ZSH
echo "export NVM_DIR=~/.nvm\nsource \$(brew --prefix nvm)/nvm.sh" >> ~/.zshrc
source ~/.zshrc
Basic commands
# list all installed node versions
nvm ls
# list all available node versions for installation
nvm ls-remote
# install selected node version and switch to them
nvm install v19.2.0
# install latest LTS node version
nvm install --lts
# switch to installed node version
nvm use v19.2.0
# print currently set node version
nvm current
# uninstall selected node version
nvm uninstall v10.15.3
I will expand this article when I discover other tools this type. If you use any other version management tools, please let me know in the comment, I'd be happy to take a look.
Featured ones: