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:
- Install asdf (using homebrew, zsh plugin...).
- Add erlang plugin to asdf. Asdf uses plugins to manage libraries.
- 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.
- Add elixir plugin to asdf.
-
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
Set global (used for your whole computer) and local (used for specific directory) version.
Issues
- When building erlang on your machine, you may encounter errors showing that cannot run some
make
commands. These issues are caused by the newestautoconf
library version, a dependency of asdf. To solve this, please removeautoconf
and then install it manually as the instruction in this link https://github.com/asdf-vm/asdf-erlang/issues/195#issuecomment-815999279 -
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
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:
Good luck!
Top comments (1)
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!