First, you will need to make sure you have prerequisites for various tasks - refer here

Then, before installing Elixir, install Erlang via asdf:

asdf install erlang 21.3

Then, install Elixir compiled against the previously installed Erlang version:

asdf install elixir 1.8-otp-21 # This will install Elixir 1.8, compiled against Erlang major version 21.

EDIT: above might be outdated. For available precompiled Elixir versions targeting certain Erlang versions, refer to this site.

Make sure you specify both Erlang and Elixir versions to be used before coding (or set them in .tool-versions file):

asdf local erlang 21.3
asdf local elixir 1.8

This will avoid you trouble when some tools do not work. In my case :observer was not working because I did not realize that my Elixir was using globally installed system-wide Erlang version, which was missing some dependencies.