Install Elixir and Erlang with asdf version manager
If you come from Ruby on Rails
for example, it’s very common to have rvm
to manage your Ruby
versions, but also you would probably need to install nvm
to manage versions for Node.js
too (since Rails
now has webpack
as the default assets pipeline).
This same story happens with Phoenix Framework
, but even adding a third language to the stage: Erlang
, Elixir
and Node.js
So how do we manage all involved languages versions with one single version manager?
meet
asdf
version manager
You can install it following the installation instructions
After installing, simply install an Erlang version by running
1
2
3
4
# to add the erlang plugin
$ asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
# to list all available erlang versions
$ asdf list-all erlang
A long list may appear, you usually would want to install the latest (at the bottom)
1
$ asdf install erlang 22.0.7
After installing Erlang, you can proceed to install Elixir with the same approach
1
2
3
$ asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
$ asdf list-all elixir
$ asdf install elixir 1.4.9
Then, in your project folder, you can tell asdf to select specific versions of software by adding a .tool-versions
file with some content like this:
1
2
3
elixir 1.9.1
erlang 22.0.7
nodejs 10.16.0
If you call asdf current
to see whats the current versions of each configured plugin inside the current working directory
1
2
3
4
5
$ asdf current
elixir 1.9.1 (set by /Users/benja/dev/newslettex/.tool-versions)
erlang 22.0.7 (set by /Users/benja/dev/newslettex/.tool-versions)
version 10.16.0 is not installed for nodejs
You notice that it says node 10.16.0 is not installed, because it reads the .tool-versions
and finds out we don’t have the requested nodejs version. To install it, simply:
1
2
3
4
5
$ asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
$ brew install coreutils
$ brew install gpg
$ bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring
$ asdf install nodejs 10.16.0
Now you have all your versions managed under asdf.