DEV Community

Long Le for OnPoint Vietnam

Posted on

Install old Erlang and Elixir version with asdf

Last weekend, I installed old Erlang and Elixir version on my Mac and faced some issues that took me some time to research and resolve. I think I should share my experience here to help you saving your time if you encounter the same issues as me.
Firstly, what is asdf and how to install multiple versions of Erlang and Elixir using asdf. I read some posts that are really helpful but this one seems to be the best: https://thinkingelixir.com/install-elixir-using-asdf/

In summary, you need to do the following steps:

  1. Install asdf (using homebrew, zsh plugin...).
  2. Add erlang plugin to asdf. Asdf uses plugins to manage libraries.
  3. Install the desired erlang version. Asdf will checkout erlang code and build this library on your machine. Problems come from here, I will explain on the issues section below.
  4. Add elixir plugin to asdf.
  5. Install the desired elixir version.

    Notice that each Elixir release has multiple versions compiled with different major versions of Erlang/OTP. To maximize compatibility between Elixir and the Erlang runtime, choose a 1-otp-XY version that matches the major version of the runtime you installed in the previous step. For example:

    asdf install elixir 1.11.2-otp-23
    
  6. Set global (used for your whole computer) and local (used for specific directory) version.

Issues

  1. When building erlang on your machine, you may encounter errors showing that cannot run some make commands. These issues are caused by the newest autoconf library version, a dependency of asdf. To solve this, please remove autoconf and then install it manually as the instruction in this link https://github.com/asdf-vm/asdf-erlang/issues/195#issuecomment-815999279
  2. Cannot compile project after downgrading Elixir and Erlang. With this issue, please do some cleanups and then recompile the project:

    rm -rf _build
    mix deps.clean --all
    mix clean
    mix deps.get
    mix compile
    
  3. ElixirLS does not working. In my case, the newest ElixirLS version is 0.8.1, is not compatible with the installed Elixir version 1.10.3. So what I did is downgrade the ElixirLS to version 0.7.0:
    Image description

Good luck!

Top comments (1)

Collapse
 
tphat2616 profile image
Phát Nguyễn

For a person who have got the error like this. Just downgrade your "MACOSX_DEPLOYMENT_TARGET" version, try with this: "export MACOSX_DEPLOYMENT_TARGET=10.0". Good luck!