Article reviewed in May 2021.
To ensure you work with the latest version of your beloved tools use Kerl and Kiex. With this approach you are able to jump between versions easily.
$ sudo pkg install kerl
$ curl -sSL https://raw.githubusercontent.com/taylor/kiex/master/install | bash -s
Before you begin to build Erlang with Kerl make sure wxWidgets are properly
installed if you want to be able to use features like :observer.start()
.
$ sudo pkg install wx30-gtk3
$ sudo ln -s /usr/lib/bin/wxgtk30u-3.0-config /usr/local/bin/wx-config
$ wx-config --version
3.0.5
Kerl uses a concept of releases (available online OTP source tarballs), builds (compiled sources) and installations (installed builds).
Enforced with this knowledge you are ready to check the latest release, build it and install it.
$ kerl update releases # get the list of Erlang releases to choose from
$ kerl build 24.0 24.0 # build relase "24.0" and give it name "24.0"
$ kerl install 24.0 ~/.kerl/installations/24.0 # install built release
To make sure that the installation was successful try to activate the new environment, verify Erlang's version and deactivate the environment when you are done.
$ source ~/.kerl/installations/24.0/activate
$ kerl active
The current active installation is:
/usr/home/codcod/.kerl/installations/24.0
$ erl -version
Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 12.0
$ kerl_deactivate # deactivate "virtual environment"
Kiex follows the same approach as Kerl. You check the latest releases, build and install one in one go.
$ kiex list releases # get the list od Elixir releases to choose from
$ kiex install 1.12.0 # install release "1.12.0"
$ kiex default 1.12.0 # make this release default
$ iex --version # check if the installation was successful
Erlang/OTP 24 [erts-12.0.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit]
IEx 1.12.0 (compiled with Erlang/OTP 24)
Add to your .zshrc
:
source "$HOME/.kerl/installations/24.0/activate"
source "$HOME/.kiex/scripts/kiex.bash"
source "$HOME/.kiex/elixirs/elixir-1.12.0.env"
Follow this blog post
to customize Elixir's REPL (.iex.exs
).
$ kerl delete build 23.3 # remove built release
$ kerl list builds # list versions built so far
$ kerl list installations # list versions installed locally
$ kerl active # show active version (installation)