[Elixir asdf] Use asdf elixir plugin to install multiple Elixir versions

asdf and Erlang Plugin

asdf is a single CLI tool for managing multiple runtime versions. It extend with a simple plugin system to install your favourite language: Dart, Elixir, Erlang, Flutter, Golang (Go), Java, Node.js, Python, Ruby …

This article is about how to use asdf and Elixir plugin to install multiple Elixir versions on macOS with the Homebrew package manager.

Prerequisites

  • Xcode Command Line Tools
    The Xcode Command Line Tools Package is a small self-contained package available for download separately from Xcode and that allows you to do command line development in macOS which is consists of the macOS SDK and command-line tools such as Clang, which are installed at this

    For more information about installing and using Xcode Command Line Tools, see the Xcode Command Line Tools

  • Homebrew
    Homebrew is the Missing Package Manager for macOS (or Linux).

    For more information about installing and using Homebrew, see the Homebrew - https://brew.sh/.

Installation

Install asdf

1
2
3
4
5
# Install asdf dependencies
$ brew install coreutils curl git

# Install asdf
$ brew install asdf

asdf Elixir Plugin

1
2
3
4
5
6
7
8
9
10
11
12
# Install Elixir plugin requirements
$ brew install openssl readline

# Elixir requires Erlang to be installed. You can use the asdf-erlang plugin to install Erlang versions.
$ asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git

$ asdf list all erlang

$ asdf install erlang 24.1.4

# Install Elixir plugin
$ asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git

List all Elixir Version

Update Elixir plugin.

1
$ asdf plugin update elixir

List all elixir versions.

1
$ asdf list all elixir

Install Elixir version

Install a Elixir version manually.

1
2
3
4
5
6
7
8
9
10
11
12
13
$ asdf install elixir 1.12.3-otp-24

$ elixir -v
No version set for command go
Consider adding one of the following versions in your config file at ~/.tool-versions
erlang 1.12.3-otp-24

$ echo "elixir 1.12.3-otp-24" >> ~/.tool-versions

$ asdf exec elixir -v
Erlang/OTP 24 [erts-12.1.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Elixir 1.12.3 (compiled with Erlang/OTP 24)

Or install another version.

1
$ asdf install elixir master-otp-24

References

[1] The Elixir programming language - https://elixir-lang.org/

[2] asdf-vm/asdf-elixir: Elixir plugin for asdf version manager - https://github.com/asdf-vm/asdf-elixir

[3] asdf-vm/asdf-erlang: Erlang plugin for asdf version manager - https://github.com/asdf-vm/asdf-erlang

[4] Index - Erlang/OTP - https://www.erlang.org/

[5] Manage asdf - https://asdf-vm.com/#/core-manage-asdf

[6] Homebrew - https://brew.sh/