1. Install Dependencies (Debian)

apt install curl git

2. Download asdf

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.1

3. Install asdf (ZSH & Git)

You can use a ZSH Framework plugin like asdf for oh-my-zsh which will source this script and setup completions.

Enable the plugin by adding it to your plugins definition in ~/.zshrc.

plugins=(asdf)

4. Install a Plugin

Each plugin has dependencies so we need to check the plugin repo where they should be listed. For asdf-nodejs they are:

apt-get install dirmngr gpg curl gawk

Install the Plugin

asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git

5. Install a Version

We can see which versions are available with asdf list all nodejs or a subset of versions with asdf list all nodejs 14.

We will just install the latest available version:

asdf install nodejs latest

6. Set a Version

asdf performs a version lookup of a tool in all .tool-versions files from the current working directory up to the $HOME directory. The lookup occurs just-in-time when you execute a tool that asdf manages.

Global

Global defaults are managed in $HOME/.tool-versions. Set a global version with:

asdf global nodejs latest

$HOME/.tool-versions will then look like:

nodejs 16.5.0

Local

Local versions are defined in the $PWD/.tool-versions file (your current working directory). Usually, this will be the Git respository for a project. When in your desired directory execute:

asdf local nodejs latest

$PWD/.tool-versions will then look like:

nodejs 16.5.0

ASDF Ruby plugin

asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git

Upgrading Ruby

asdf plugin update ruby
asdf list ruby
asdf install ruby 3.2.5
asdf global ruby 3.2.5
# or
# asdf local ruby 3.2.5

via: Getting Started - asdf