Erlang can be installed with pkg_add by running this command:

doas pkg_add install erlang erl27-rebar3