DEV Community

loading...
Cover image for Installing Erlang & Elixir using asdf on M1 Macs

Installing Erlang & Elixir using asdf on M1 Macs

Oliver Andrich
Loves coffee, code and a good conversation. Currently, mostly working with React Native, Python, Elixir and Phoenix.
・2 min read

This weekend I discovered, that somehow Elixir-LS in VSCode and Sublime Text stopped to support autocompletion. ElixirSense crashed because of unknown functions. The solution was to upgrade to Elixir 1.12.3 as suggested by this comment on GitHub.

During the upgrade, I decided to also upgrade Erlang and do a complete fresh installation of Erlang and Elixir on my M1 MacBook. Sadly, the tutorial I have been following before I have owned a M1 MacBook, didn't work any longer. Erlang didn't compile successfully because it was unable to find the wxmac and unixodbc libraries. I had to add some extra options to solve this.

I assume you have installed asdf already, but here is the full installation command I use after reading the Tutorial by Andres.

brew install asdf autoconf wxmac openssl fop coreutils \
             automake libyaml readline libxslt libtool \ 
             unixodbc unzip curl
Enter fullscreen mode Exit fullscreen mode

Next you have to set some extra environment variables that tell kerl where to find wxmac and unixodbc, like suggested by this comment on GitHub.

export CFLAGS="-O2 -g -fno-stack-check"
export KERL_CONFIGURE_OPTIONS="--disable-hipe --with-ssl=$(brew --prefix openssl) --with-wx-config=$(brew --prefix wxmac)/bin/wx-config --with-odbc=$(brew --prefix unixodbc)" 
export CPPFLAGS="-I$(brew --prefix unixodbc)/include"
export LDFLAGS="-L$(brew --prefix unixodbc)/lib"
Enter fullscreen mode Exit fullscreen mode

Now you are ready to install Erlang 24 and Elixir 1.12.3 using asdf.

asdf install erlang 24.0.6
asdf global erlang 24.0.6
asdf install elixir 1.12.3
asdf global elixir 1.12.3
Enter fullscreen mode Exit fullscreen mode

With Elixir 1.12.3 autocompletion works again for me.

P.S.: Of course you can also wait for the update of the homebrew elixir package, but I prefer to manage my environments using asdf.


Photo by Antonio Scalogna on Unsplash

Discussion (0)