Malte Krupa


Install Elixir On FreeBSD - 2022-11-27

Install Elixir on FreeBSD

TL;DR:

# pkg install elixir-devel erlang-runtime25
# setenv PATH /usr/local/lib/erlang25/bin:$PATH

I’m still relatively new around FreeBSD, so some things are not as obvious to me as others. One thing that took me quite some time was the installation of a relatively recent version of elixir on FreeBSD.

Looking at a pkg search for elixir shows the following packages:

elixir-1.13.4_1                Functional, meta-programming aware language built on top of Erlang VM
elixir-devel-1.14.0            Functional, meta-programming aware language built on top of Erlang VM
[..]

Of course I only saw the first line and didn’t bother to look any further. m(

After spending an afternoon learning howto build or update a FreeBSD packages myself using poudriere I came across elixir-devel on freshports. Not my proudest moment.


This elixir version 1.14.0 isn’t the latest but it is close enough for now.

Another thing you’ll need is erlang. Let’s see what pkg search erlang has to offer:

erlang-24.3.4.5,4              Functional programming language from Ericsson
[..]
erlang-runtime21-21.3.8.24_1   Functional programming language from Ericsson
erlang-runtime22-22.3.4.26     Functional programming language from Ericsson
erlang-runtime23-23.3.4.16     Functional programming language from Ericsson
erlang-runtime24-24.3.4.4      Functional programming language from Ericsson
erlang-runtime25-25.1          Functional programming language from Ericsson

Searching for -devel does not help here but a little bit down the list we can find -runtime versions of the package. They are available in different versions and even a relatively recent version of Erlang/OTP 25 is available.

This is all I need, so there is no need to change the FreeBSD release channel for now. Hint: Changing the release channel from quarterly to latest might be a way to get even newer packages without starting to build our own packages.

After installing erlang-runtime25 we’re greeted with the following message:

To use this runtime port for development or testing, just prepend
its binary path ("/usr/local/lib/erlang25/bin") to your PATH variable.

We can do so via the following command:

# setenv PATH /usr/local/lib/erlang25/bin:$PATH

We can now use the iex command to start a shell:

# iex
Erlang/OTP 25 [erts-13.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns] [dtrace] [sharing-preserving]

Interactive Elixir (1.14.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>

Hint: Yes, these commands were run in a root shell which you can identify by the # in front of every command. I ran all of this in a testing jail which was deleted even before this post was created.


Privacy Policy | Imprint