Benjamín Silva
Posted on November 26, 2020
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
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
# 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)
$ asdf install erlang 22.0.7
After installing Erlang, you can proceed to install Elixir with the same approach
$ 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:
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
$ 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:
$ 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.
Posted on November 26, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.