DEV Community

Cover image for How to install erlang on macOS with asdf
Andres RV
Andres RV

Posted on

How to install erlang on macOS with asdf

The problem

Currently some errors are happening when we try to compile/install erlang on mac OS Catalina with any method. Looking for the solution on the web, I found a way that finally worked for me.

The solution

We have to already have installed asdf, the asdf-erlang plugin, and also homebrew.

Install dependencies

Let's install some mandatory dependencies.

brew install autoconf wxmac openssl
Enter fullscreen mode Exit fullscreen mode

I recommend to install other packages too.

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

Set environment variables

Once installed these packages, we need to set two environment variables before to install asdf.

export CFLAGS="-O2 -g -fno-stack-check"
Enter fullscreen mode Exit fullscreen mode
export KERL_CONFIGURE_OPTIONS="--disable-hipe --with-ssl=$(brew --prefix openssl)"
Enter fullscreen mode Exit fullscreen mode

If you haven't installed Java (or you don't want to install it), then set the second variable like this:

export KERL_CONFIGURE_OPTIONS="--disable-hipe --without-javac --with-ssl=$(brew --prefix openssl)"
Enter fullscreen mode Exit fullscreen mode

Install erlang

Now you can install the erlang version you need. In my case, I was needing to install the specific version 20.3.8.7.

asdf install erlang 20.3.8.7
Enter fullscreen mode Exit fullscreen mode

I hope this method also work for you 😉.

Source link

I found the solution to my problem in this comment.

Top comments (1)

Collapse
 
chlorophytus profile image
Roland Metivier

I think --disable-hipe disables native Erlang compile, but that performance enhancement was removed in Erlang/OTP 24 due to a lack of maintainers.

The JIT compiler seems to replace it.