Erlang can be installed with MacPorts by running these commands:

sudo port install erlang
sudo port install rebar3