2022-10-12
ElixirErlangNode

Install or Update to Elixir 1.14

The recommended way to install Elixir, and it also supports Erlang and Node, is to use ASDF. That is a tool version manager that allows you to run different versions of Elixir and Erlang on the same computer. https://asdf-vm.com/

Installation

If you are on a Mac, you can install it with:

brew install asdf

Add asdf.sh to your ~/.zshrc with:

echo -e "\\n. $(brew --prefix asdf)/asdf.sh" >> ~/.zshrc

Add Elixir Plugin

Add Erlang and Elixir to the list of avaliable plugins.

asdf plugin add erlang
asdf plugin add elixir


Note, that you can optionally add nodejs as well if you dont already have it installed.

I can check the installed plugins by running:

With the Elixir plugin installed, you can list all available versions by typing:

asdf list all elixir

The latest version as of today is 1.14.1-otp-25 so I can install it with the command:

asdf local elixir 1.14.1-otp-25

You can now see that it works in the console by running:

elixir -v

Most likely, this command will crash. That is because I dont have the Erlang version installed that corresponds to the OTP version that I used when pinging the Elixir version.

Install Erlang

In this example, I need Erlang 25. I can run the same list command again and see the available versions:

asdf list all erlang

Then I can see the latest version of Erlang 25. And when I write this, its version 25.1.1 so I install it with the command:

asdf install erlang 25.1.1

The installation can take a few minutes and after that is done, I am prompted with setting the global or local Erlang version. Depending on how many different projects you have going with different version you can chose what suits you. I go with global in this example:

asdf global erlang 25.1.1

I can now check that everything works in the console by running:

elixir -v

If everthing works, I should see something like: