3 min read

Using ASDF to Manage Programming Language Runtime Versions

Using ASDF to Manage Programming Language Runtime Versions

Languages, frameworks, and tools are constantly updated in an open-source environment, just like distribution packages. Because it is not a good idea to manually install programs or build from sources, version managers are available.

When I worked with the .NET Framework, there were no significant issues with version languages; at the time, regular updates were focused on security patches.

However, with the release of the .NET Framework Core and Microsoft's embracing of the open-source framework, the closed libraries became open, and .NET core versions began to be released at the same rate as Ruby, Python, and Node.js.

Given that dealing with language versions is a common issue for all developers, your local environment should be able to support versions in order to simulate production environments.

What is ASDF?

ASDF is a command-line tool that allows you to manage multiple language runtime versions. It is useful for developers who use a runtime version list.

ASDF works similarly to rbenv, rvm, nvm, and other version managers, but it also supports a variety of languages. Languages are supported over plugins; see the list below.

It is a short list; more can be found in the ASDF repository.

Installing ASDF

If you use something other than bash and zsh, look into official installation because there is more coverage.

Install requirements (git and curl) before proceeding:

sudo apt install -y curl git

sudo yum install -y curl git

sudo dnf install -y curl git

sudo pacman -S curl git

There are several ways to install ASDF (HomeBrew, Pacman, and Git), but the official guide strongly suggests using Git.

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

At the moment, the most recent ASDF version is v0.10.2. Set up your shell environment now.

I recommend putting the ASDF command inside a profile ( ~/.profile ~/.bash_profile, ~/.bashrc or ~/.zshrc) and referencing it from .bashrc or.zshrc.

Shell profile

Create or update a profile file with the name .profile, then call it from .bashrc or .zshrc using the command to source ~/.profile.

. $HOME/.asdf/asdf.sh

Append to your rc file (bashrc or zshrc).

source ~/.profile

Reload your shell, and then type asdf to check the installation.

Installing plugins

ASDF has a plugin system to support many languages, and I'll show some Erlang and Elixir recipes, languages I have used the most in my present work.

asdf plugin add erlang
asdf plugin add elixir

It's coffee time, the Erlang installation is compiling from source and will take some to finish.

Before choosing on a version, consult the Erlang and Elixir compatibility tables.

Elixir version Supported Erlang/OTP versions
1.14 23 - 25
1.13 22 - 24 (and Erlang/OTP 25 from v1.13.4)
1.12 22 - 24
1.11 21 - 23 (and Erlang/OTP 24 from v1.11.4)
1.10 21 - 22 (and Erlang/OTP 23 from v1.10.3)
1.9 20 - 22
1.8 20 - 22
1.7 19 - 22
1.6 19 - 20 (and Erlang/OTP 21 from v1.6.6)
1.5 18 - 20
1.4 18 - 19 (and Erlang/OTP 20 from v1.4.5)
1.3 18 - 19
1.2 18 - 18 (and Erlang/OTP 19 from v1.2.6)
1.1 17 - 18
1.0 17 - 17 (and Erlang/OTP 18 from v1.0.5)

I always go for the most recent versions, apologies for being an early adopter.

Check the available versions

asdf list-all erlang
asdf list-all elixir

Installing Erlang/OTP

asdf install erlang 25.1

Installing Elixir

asdf install elixir 1.14

Set a language version for each project

ASDF looks up the language version in a file called .tool-versions; if this file is missing, ASDF will use the default language version.

A sample of .tools-versions

elixir 1.14
erlang 25.1

You should place this file in the root project directory to allow ASDF in determining which version to use.

Set a language version to be global

When there is no .tools-versions file, you can set a global language version as a fallback.

asdf global elixir 1.14
asdf global erlang 25.1

Checking versions

iex --version
# > Erlang/OTP 25
# > IEx 1.14.1 (compiled with Erlang/OTP 23)


I strongly recommend using ASDF for your Elixir projects; I previously used kiex & kerl and had a bad experience. Keep your efforts with languages rather than tools.

See you later! Packages have already been upgraded.