How to install Elixir in Manjaro Linux

Published on 2018/03/08 ‚óŹ Updated on 2018/11

Table of contents

Install asdf

I really like using version managers to install different coexisting versions for the dev languages that I use.

I’ve been using asdf the extendable version manager, to install Erlang and Elixir with OTP support, and it’s been great.

Clone the GitHub repository:

git clone ~/.asdf --branch v0.6.0

Add some lines to your .profile and .bashrc files:

echo -e '\n. $HOME/.asdf/' >> ~/.profile
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc

Make changes effective with:

source ~/.profile
exec $SHELL

We add to .profile and not to .bashrc, because it will have the side effect of allowing applications started through dmenu —for i3 users— to have the elixir command available.

This is because stuff in .profile gets loaded when you login into your account, so anything there will be available to commands run through dmenu or desktop icons.

But, stuff in .bashrc gets loaded everytime you open a terminal —so another solution, would be to just start code from the CLI.

Install Erlang and Elixir

Install some needed dependencies for Erlang —we need WxWidgets so we can use :observer.start:

sudo pacman -S unixodbc wxgtk
# You have most of what's needed already installed.
# The full list of dependencies would be:
# sudo pacman -S base-devel glu libpng libssh mesa ncurses unixodbc wxgtk

For Ubuntu you need these dependencies:

sudo apt install build-essential autoconf m4 libncurses5-dev libwxgtk3.0-dev \
libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev

Finally install Erlang and Elixir:

asdf plugin-add erlang
asdf list-all erlang
asdf install erlang 21.1.2
asdf global erlang 21.1.2

asdf plugin-add elixir
asdf list-all elixir
asdf install elixir 1.7.4-otp-21
asdf global elixir 1.7.4-otp-21

To activate iex REPL history, add this to your .bashrc:

echo -e '\nexport ERL_AFLAGS="-kernel shell_history enabled"' >> ~/.bashrc

If you are using this awesome editor (hint: Visual Studio Code), you should try the ElixirLS extension.

Install Hex

Let’s take on Hex the package manager now:

mix local.hex

You can now print some info about your Elixir stack with:


You’ll see something along the lines of:

Hex:    0.18.2
Elixir: 1.7.4
OTP:    21.1.1

Built with: Elixir 1.7.4 and OTP 19.3

Install Phoenix

Now let’s install a web framework:

mix archive.install hex phx_new 1.4.0

To create a new API only web app, try with this command:

mix my-app --app my_app --module MyApp --no-html --no-webpack

If you want to follow up on building an API using Elixir, check this out:
Building a JSON API with Phoenix and Elixir

That’s it!


— lt

Feedback & comments

Get in touch on Twitter

Or by good ol' email at