I'm getting into Elixir, but before I could start doing anything I had to install it. Since I use asdf to manage language versions, I wrote down how I did it on my machine.
If you want to know more about asdf, I talked about it in my first post.
Setting up Ruby and Node.js with ASDF
For those who don't know, Elixir is an open-source programming language created by José Valim at Plataformatec (a company that was bought by Nubank).
Elixir is a modern, dynamic and functional language. It runs on the Erlang VM, known for low-latency, concurrent, fault-tolerant, distributed and scalable systems (more info).
Let's go.
To start we need to install asdf. It's pretty easy, just follow the tutorial on the project page.
With asdf installed and set up, we need to install some Erlang dependencies.
# OSX
$ brew install autoconf
---
# Ubuntu / Debian
$ sudo apt-get -y install build-essential autoconf m4 libncurses5-dev libwxgtk3.0-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop
For other operating systems I don't know how to install with asdf, but it's possible to install Elixir somehow, either through docker or some executable.
Now we're ready to install Erlang.
# Add the Erlang plugin with all available versions.
$ asdf plugin-add erlang
# Show all available Erlang versions.
$ asdf list-all erlang
# Install Erlang.
$ asdf install erlang 22.2.2
# Set the default Erlang version on the OS.
$ asdf global erlang 22.2.2
# This may take a while, it's compiling Erlang.
Before continuing with the Elixir installation, it's important to understand how the versions work together (or don't).
The Erlang version is often called the OTP version. The Elixir version you use must be compiled specifically for the Erlang version you're running.
If you use an Elixir version compiled with a different Erlang (OTP) version, you might run into problems.
The version we installed is 22. To check the version from the console it's pretty simple.
Now that we've confirmed it's OTP-22, let's install Elixir.
# Add the Elixir plugin with all available versions.
$ asdf plugin-add elixir
# Show all available Elixir versions.
$ asdf list-all elixir
# Install Elixir.
$ asdf install elixir 1.9.4-otp-22
# Set the default Elixir version on the OS.
$ asdf global elixir 1.9.4-otp-22
Now run elixir -v and confirm both versions.
After confirming the versions, just run iex and see if everything is ok.
Conclusion
There are other ways to install Elixir, but I like to keep everything possible concentrated in asdf, like Ruby, Node, Elixir, Erlang, Python and others.
I've heard about Elixir since it appeared and I built small things to play with, but I never really got into it. What motivated me, besides the job opportunities popping up in Brazil and the world, is the community. Everyone is very welcoming and embraces diversity, which in my view is exactly what's needed to grow a language further.
Sources:
- Official documentation
- Elixir Casts - Installing Elixir with asdf
- Thinking Elixir - Install Elixir using asdf
Thanks:
Thanks Adolfo Neto for the important feedback about the Erlang OTP and for pointing me to Thinking Elixir. I'll definitely follow.
Originally posted at guilherme44.com.



Top comments (0)