dogweather

dogweather

How to choose Elixir + Erlang versions to install

I realized that I’m just guessing what all the version numbers mean — and there are a lot of them. I’m not sure if this is documented anywhere. (?) Here’s what I do on MacOS, which seems to work:

  1. Install asdf
$ brew install asdf
  1. Install the asdf plugins for Elixir and Erlang. (Is it necessary to do both? I think so.)
$ asdf plugin add elixir
$ asdf plugin add erlang
  1. Look at the Elixir versions available:
$ asdf list all elixir

...
1.14.0
1.14.0-otp-23
1.14.0-otp-24
1.14.0-otp-25
1.14.0-rc.0
1.14.0-rc.0-otp-23
1.14.0-rc.0-otp-24
1.14.0-rc.0-otp-25
1.14.0-rc.1
1.14.0-rc.1-otp-23
1.14.0-rc.1-otp-24
1.14.0-rc.1-otp-25
main
main-otp-22
main-otp-23
main-otp-24
main-otp-25
...
  1. The version 1.14.0-otp-25 seems like the most recent production-ready one, so I install that:
$ asdf install elixir 1.14.0-otp-25
  1. Now I need to find a compatible Erlang version. (Am I correct here?)
$ asdf list all erlang

...
24.3.4.6
25.0-rc1
25.0-rc2
25.0-rc3
25.0
25.0.1
25.0.2
25.0.3
25.0.4
25.1
25.1.1

Cool, the number 25 matches otp-25 from the Elixir package, and although the 25 here theoretically refers to the Erlang version and the other refers just to OTP, I suspect the nomenclature is rather loose. So I install 25.1.1:

$ asdf install erlang 25.1.1

Excellent! I’m almost ready to get to work. I have just one more hour ahead of me:

  1. Try to write Elixir code in VS Code with the LSP.
  2. It’s broken. Try to debug my dev env unsuccessfully. Post a forum question. Learn that the LSP has an undocumented dependency on OTP < 25.
  3. Redo all the above steps with Erlang 24 and Elixir with otp-24.
  4. Test all of this, and it appears to work: My inference about Erlang 24 = top-24 might be correct.

This is the setup process for new Elixir devs. :smile: Did I miss some docs or sign-posts along the way that would have made this easier?

Marked As Solved

Eiji

Eiji

Elixir

Ok, let’s describe it step by step:

  1. Although Elixir projects are not required to follow SemVer, they must follow the format outlined on SemVer 2.0 schema.
  2. x.y.z at the start is the version of Elixir
  3. -rc.x is a x release candidate for said version
  4. -otp-x is a precompiled Elixir release for x major Erlang version
  5. The release without otp part before install needs to be compiled first with already installed and officially supported Erlang version
  6. main is the name of git branch which means you can test more or less stable new features before they added to an official release

If you want to install latest Elixir together with latest supported Erlang and you are not interested in release candidates as well as unstable main branch then you need to select release with latest x.y.z version of Elixir and latest -otp-x version, currently 1.14.0-otp-25.

Erlang

In Erlang it’s much easier as it does not have a precompilled releases for other languages.

  1. a.b or a.b.c or a.b.c.d at the start is the version of Erlang - here we do not have padded .0 except b
  2. -rcx is a x release candidate for said version
  3. master is the name of git branch which means you can test more or less stable new features before they added to an official Erlang/OTP release
  4. maint and maint-x are stable git branches based on previous work in master, see otp/CONTRIBUTING.md for more information

Again if you look for latest stable release for Elixir version -otp-25 you need to select latest a.b or a.b.c or a.b.c.d - currently it’s 25.1.1.

Compile from source

If you want to compile Elixir on your own and you want to know which Erlang versions are supported then you can take a look at other releases or the documentation: Compatibility and Deprecations — Elixir 1.14.0 and Compatibility and Deprecations — Elixir v1.15.0-dev (main branch)

Erlang prebuild releases

There are prebuilt packages for Ubuntu LTS releases, see:

  1. michallepicki/asdf-erlang-prebuilt-ubuntu-18.04
  2. michallepicki/asdf-erlang-prebuilt-ubuntu-20.04
  3. michallepicki/asdf-erlang-prebuilt-ubuntu-22.04

There is also an open issue to officially support prebuilt packages in asdf-erlang repository, see: Support for precompiled binaries? asdf-vm/asdf-erlang#165

That’s all important things about Elixir and Erlang in asdf-based environment. Unfortunately I’m not MacOS user, so I don’t have any information specific to this OS.

Also Liked

cmo

cmo

Isn’t it even worse if you want wxwidgets compiled in the asdf version of erlang? I usually use Windows which is just scoop install erlang elixir and was a little frustrated by how much harder it was setting it up with asdf on Linux.

Weren’t the ElixirLS issues with OTP 25 patched recently? It’s been working for me for at least a couple of weeks.

LostKobrakai

LostKobrakai

It depends on the elixir release, but generally there can be compile time checks in elixir to make use of new OTP features if compiled against a specific version.

By default elixir is compiled with the lowest supported OTP version, so using one compiled with a more recent one might unlock additional optimizations.

axelson

axelson

Scenic Core Team

I’d highly recommend not installing asdf via homebrew. I can dredge up the GitHub issues later but it causes many things to break when updating the version of asdf itself.

derek-zhou

derek-zhou

On linux you don’t even need asdf. just old fashion ./configure; make; make install and you have OTP. If you are lazy, just use whatever the distribution provides. I always compile elixir myself. It is only a minute and it is a good sanity check of your Erlang environment.

Hermanverschooten

Hermanverschooten

in asdf the version suffix in the elixir distribution is to tell you which erlang version it was compiled against. I don’t know if there is actually a difference between them, but I always make sure they are in the same major range.
I am not using VSCode, but Lunarvim and have no issues with elixir-lsp and erlang 25+

Where Next?

Popular in Questions Top

JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
Fl4m3Ph03n1x
Background Let’s assume I have a typical GenServer that receives messages as requests, does some operation in a DB and returns responses....
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New

Other popular topics Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
beno
I will often find my self writing things similar to: case some_value do nil -&gt; something() "" -&gt; something() _ -&gt; someth...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

We're in Beta

About us Mission Statement