- Elliot DeNolf
Dabbling in multiple programming languages can be a lot of fun. However, because each language tends to have its own version manager, remembering each version manager's commands can get a little cumbersome. This is why the idea of having a single version manager for all of your languages is very intriguing. Asdf is a version manager that aims to do that. It supports a large number of languages, all with only one set of commands to remember.
Let's get it installed, add a language plugin, then activate the desired language version.
Installation is performed using either Homebrew on macOS or Git on Linux.
brew install asdf
git clone https://github.com/asdf-vm/asdf.git ~/.asdf
You must then source the script by adding the following line to your
See the latest documentation if more detail is needed.
Asdf has the concept of "plugins" for each supported language. We need to install a plugin for any language we want to use.
First, let's list all available plugins using
# many more...
From the list, let's add the Node.js plugin.
asdf plugin-add nodejs
Once the plugin is added, we can list all versions available to us.
asdf list-all nodejs
# many more...
Any version from the list can be installed, we'll install the latest LTS.
asdf install nodejs 12.18.1
Once installed, we declare this version as the one we'd like to use globally on our system.
asdf global nodejs 12.18.1
If you need to run a specific version only for a single project, we can do that using the
asdf local command.
asdf local nodejs 10.21.0
This will create a file named
.tool-versions that specifies which version should be used within the current project. Asdf will automatically detect and use that version if it is installed.
The above steps can be repeated for any language we'd like.
All plugins and versions installed can be viewed with the
asdf list command.
Asdf is a very powerful tool that can replace aany number of version managers. I'd highly recommend using it if you use more than a couple languages on your system and have a need to switch between versions. Head on over to their documentation if you'd like to learn more.