Published August 20, 2018
In episode #64 we looked at my editor setup for ElixirCasts, but if we don’t have Elixir installed we wont get very far. In this episode we’ll look at one way to install Elixir.
I’ve been using the version manager
asdf to handle different versions of Elixir. What’s nice about
asdf is that it easily lets you manage different versions of multiple programming languages, like Node and Ruby.
Here are the more comprehensive install instructions, but let’s take a look at how we can install and use it. I’ll copy the URL to download it. And since I’m on a Mac, I’ll be following the instructions for MacOS in the Readme. We’ll clone
asdf and add it to the
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.5. ... $ echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profile $ echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile
Now once everything is installed we’ll restart our shell and let’s check that
asdf was installed by running
asdf. And great, we see all the available commands printed. The first thing we’ll want to do is install the plugin that we want. Let’s add the Elixir plugin with
asdf plugin-add elixir.
Then once it’s installed we can list all the available versions of Elixir with
asdf list-all elixir and we get versions of Elixir from 1.3 to to 1.7 available. Let’s install 1.7.2 with
asdf install elixir 1.7.2. Once it’s finished we can list all installed versions with
asdf list elixir and we see the version we installed is printed.
Now we can set the local version of Elixir to use with
asdf local elixir 1.7.2 and then if we run
elixir -v we get an error. This is because we haven’t installed Erlang.
$ asdf plugin-add elixir ... $ asdf list-all elixir 1.3.4 ... 1.7.2 $ asdf install elixir 1.7.2 ... $ asdf list elixir 1.7.2 $ asdf local elixir 1.7.2 $ elixir -v erl: not found
Let’s install it. We’ll add the Erlang plugin. Then let’s list the available versions and install Erlang 21.
And then we’ll set this version of Erlang as our global version. Now let’s start up
iex to see if everything works. And great, it started and we see the correct versions of Elixir and Erlang printed.
$ asdf plugin-add erlang ... $ asdf list-all erlang ... 21.0.5 $ asdf install erlang 21.0.5 ... $
In this episode we looked at one way to install Elixir and Erlang using