Installing Elixir 1.2 on a Raspberry Pi

I’ve been playing with Elixir off and on over the past couple of months and wanted a way to run some things using Elixir on my Raspberry Pi. Sadly, there aren’t any packages for Elixir that are up to date and work on the Raspberry Pi. Due to the lack of packages, I compiled it from source. Here’s how I did it. I have both an original Raspberry Pi and a Raspberry Pi 2 and the instructions below will work with both. We’ll assume you’re the pi user on your Raspberry Pi and that you can run commands as root using sudo.

We’ve got to start off building Erlang first, because the packages for Raspbian Jesse are too old to support Elixir 1.2

1. Install the necessary packages so we can build Erlang:

sudo apt-get install libssl-dev ncurses-dev m4 unixodbc-dev

2. Download and extract the Erlang 18.2.1 release from

curl -O
tar xf otp_src_18.2.1.tar.gz

3. Compile all the Erlang bits. We’ll install Erlang into /opt/erlang/18.2.1 which is just an arbitrary choice.

cd otp_src_18.2.1
./configure --prefix=/opt/erlang/18.2.1
sudo make install

Erlang’s install documentation is an excellent resource if you want to dig more into how to build and install Erlang. For example, they recommend building and running the smoke tests for the compiler, but I’ve chosen not to do that here. The above commands come from their docs and do the following:

  1. Go into the source directory
  2. Set up a shell variable we’ll use a few steps later
  3. Build Erlang
  4. Install the Erlang compiler and runtime into our chosen location.

Now that we have Erlang compiled and installed, it’s time to install Elixir. Fortunately, this process is much easier and much quicker.

1. Download the precompiled release for the Elixir version we want.

curl -L -O

2. Create the path we’re going to install Elixir into

sudo mkdir -p /opt/elixir/1.2.3

3. Extract the Elixir release into its path

sudo unzip -d /opt/elixir/1.2.3

The last bit to get everything set up is to add both /opt/erlang/18.2.1/bin and /opt/elixir/1.2.3/bin to your $PATH. In my case, I just chose to hack /etc/profile directly. Due to the myriad of ways this can be accomplished, I’m leaving this as an exercise to the user.

Super huge thanks to @wtfleming for their post about doing embedded work on a Raspberry Pi with Elixir. I took a lot of what they wrote and extracted and built upon it while writing this post.