Skip to main content
GitHub
elixir

Switching an Elixir project between Erlang/OTP major versions with asdf

2025-01-29 in Particles

Assumptions

We manage runtimes with asdf. In this example we’re using Elixir 1.17.3 in a project and want to switch from OTP 26.2.5.6 to OTP 27.2.

Steps

0. Check the status quo

See which versions of any installed runtimes, including Elixir and Erlang/OTP, are set for the current directory, and see if that’s through the global .tool-versions config file or a local one:

asdf current

See which versions of Erlang/OTP are installed on the system with asdf:

asdf list elixir
asdf list erlang

1. Install the new Erlang/OTP

asdf install erlang 27.2

2. Install an Elixir version compiled with the right OTP major version

Even if we don’t want to upgrade Elixir versions per se, we do need to match the Elixir installation with our OTP major version.

asdf install elixir 1.17.3-otp-27 

3. Set the project to use the newly installed versions of both

asdf local elixir 1.17.3-otp-27
asdf local erlang 27.2

Now asdf is configured to point to the newly installed version of Erlang/OTP and the Elixir version that’s compatible with it.

References

Particles index