Install Erlang on Ubuntu 22.04

Here's how to install Erlang on Ubuntu 22.04. Maybe works for versions before/after; I have not tested.

Erlang Version Manager

First, pick a source for erlang. I recommend you use asdf, the best version manager around.

Install asdf Plugins

asdf plugin add erlang
asdf plugin add elixir

Potentially Optional: Erlang Prereqs

If I try to install erlang directly with asdf, I first get this error:


asdf_22.1.7 is not a kerl-managed Erlang/OTP installation

My next attempt worked much better, as suggested on the asdf-erlang Github thread, install a bunch of supporting libs:

sudo apt install clang-format clang-tidy clang-tools clang clangd libc++-dev libc++1 libc++abi-dev libc++abi1 libclang-dev libclang1 liblldb-dev libllvm-ocaml-dev libomp-dev libomp5 lld lldb llvm-dev llvm-runtime llvm python3-clang automake autoconf libncurses5-dev

The second prereq problem might be this error that I've gotten after installation and on my first run of mix:

** (Mix) The application "crypto" could not be found. This may happen if your Operating System broke Erlang into multiple packages and may be fixed by installing the missing "erlang-dev" and "erlang-crypto" packages

This can be solved by uninstalling erlang and elixir, then installing Open SSL:

asdf uninstall erlang 26.2.1
asdf uninstall elixir 1.16.1
sudo apt install libssl-dev

Or making openssl from source.

Use Asdf to Install

Get the latest erlang and elixir stable versions:

asdf list all erlang
asdf list all elixir

Then install the libraries. As of now, those are:

asdf install erlang 26.2.1
asdf install elixir 1.16.1

Then change into the directory of your project, and set the version:

asdf local erlang 26.2.1
asdf local elixir 1.16.1

Or set it globally:

asdf global erlang 26.2.1
asdf global elixir 1.16.1

You're ready to rumble:

mix run
mix test