Dev life

Install elixir with asdf

January 15, 2019

Install Elixir with asdf

Elixir 1.8.0 is released today, let’s try it with asdf.

Install asdf and plugins

# install asdf
> git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.6.2
# Checking https://github.com/asdf-vm/asdf#setup to setup according to your OS and shell

# install plugins
> asdf plugin-add elixir
> asdf plugin-add erlang

install Elixir precompiled packages

### install 1.8.0 with oldest supported OTP release: OTP 20
> asdf install elixir 1.8.0

### or 1.8.0 with recent OTP 21
> asdf install elixir 1.8.0-otp-21

# install Erlang
> asdf install erlang 21.2

Set version for Elixir and Erlang

### set version globally
> asdf global elixir 1.8.0
> asdf global erlang 21.2

### or locally (in the project root directory)
> asdf local elixir 1.8.0
> asdf local erlang 21.2

Check current activated versions

> asdf current
elixir         1.8.0-otp-21 (set by /Users/goofansu/.tool-versions)
erlang         21.2     (set by /Users/goofansu/.tool-versions)

(Optional) Check which OTP version compiles the Elixir package?

> iex -e "IO.inspect Kernel.__info__(:compile); System.halt"`
Erlang/OTP 21 [erts-10.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]

[
  version: '7.3',
  options: [
    :dialyzer,
    :no_spawn_compiler_process,
    :from_core,
    :no_auto_import,
    {:inline, [bootstrapped?: 1]}
  ],
  source: '/home/build/elixir/lib/elixir/lib/kernel.ex'
]

It shows the Elixir package is compiled under compiler 7.3, it belongs to OTP 21.2 according to http://erlang.org/download/OTP-21.2.README

References


goofansu

Written by goofansu who lives and works in Shanghai, China building useful things. Follow him on Twitter