Install Erlang on FreeBSD

pkg on FreeBSD

FreeBSD carries Erlang in the ports collection as lang/erlang, and the binary package has the same name. It installs under /usr/local, so erl lands in /usr/local/bin and no path change is needed.

Update the package catalogue, then install Erlang.

sudo pkg update

sudo pkg install erlang

Verify the install

The shell is the program erl. Ask it for the version: the answer names the emulator and its version, which belongs to the OTP release that pkg installed.

erl -version

Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 15.2.7.14

Ask the runtime for the OTP release number itself:

erl -noshell -eval 'io:format("~s~n", [erlang:system_info(otp_release)]), halt().'

27

Both answers were measured on Erlang/OTP 27; the current FreeBSD package is Erlang/OTP 28 and prints its own numbers.

If erl is not found, close the terminal, open a new one, and try again.

Erlang and Elixir

Elixir is a language that compiles to the same BEAM bytecode and runs on the same virtual machine, the same libraries and the same error handling. It adds a Ruby-like syntax and metaprogramming macros on the same foundation.

The lang/elixir port depends on lang/erlang, so pkg install elixir pulls this runtime as well. The Elixir course starts with that install.

Article author: Arthur Isaev

Banner image