yeshan333

yeshan333

How to install multiple versions of Erlang and Elixir with vfox

vfox (version-fox) is a popular general version management tool write in Go, and the plug-in mechanism uses Lua to achieve extensibility. At present, vfox has supported the management of most mainstream programming language versions, and the ecosystem is quite strong. Here you can see the programming language versions and tools that vfox currently supports and manages → vfox-Available Plugins.

The Elixir and Erlang communities have long been popular for installing and managing multi-version environments through asdf. asdf is also a general-purpose version management tool, and the ecosystem is so rich.

Vfox is very similar to asdf-vm in that it uses .tool-versions file to manage project-level and global version information. This means that if you’ve used asdf before, it won’t be difficult to switch to vfox. Because the core implementations of vfox and vfox are a bit different, vfox executes nearly 5 times faster than ASDF~, and the official documentation also gives benchmark results: version-fox Comparison with asdf-vm

https://vfox.lhan.me/performence.png

If you’ve been using asdf to manage and maintain multiple versions of Erlang and Elixir, then vfox is also a good choice for you.

This article will show you how to install and manage multiple versions of Erlang and Elixir via vfox.

Install vfox

vfox (version-fox) is cross OS system friendly, which means it can be used on both Windows and Unix-like systems. The core of this article is to install and manage multiple versions of Erlang and Elixir through vfox. Because the two plug-in implementations of vfox to manage Erlang and Elixir versions do not yet support management under the Windows operating system, the sample environment in this article is mainly the Ubuntu 20.04 Linux environment. Let’s get started~

Install vfox (version fox) first:


echo "deb [trusted=yes] https://apt.fury.io/versionfox/ /" | sudo tee /etc/apt/sources.list.d/versionfox.list

sudo apt-get update

sudo apt-get install vfox

In order for vfox to find the installed versions of Elixir and Erlang, vfox needs to be mounted to the shell by default. Next, modify the shell configuration (take Bash as an example):


# Hook your shell

echo 'eval "$(vfox activate bash)"' >> ~/.bashrc

You can also refer to this official documentation to install vfox → https://vfox.lhan.me/guides/quick-start.html. After installing VFOX, let’s install the following plugins:


# add vfox-erlang plugin

vfox add erlang

# add vfox-elixir plugin

vfox add elixir

Next, we can install and manage multiple versions of Erlang and Elixir through the two vfox plugins vfox-erlang and vfox-elixir installed above.

Install Erlang/OTP via the vfox-erlang plugin

Because Elixir depends on Erlang, we need to install Erlang before installing Elixir. Erlang is installed through the source code of the corresponding version, so we need to have the corresponding compilation toolchain, here take Ubuntu 20.04 as an example:


sudo apt-get -y install build-essential autoconf m4 libncurses5-dev libwxgtk3.0-gtk3-dev libwxgtk-webview3.0-gtk3-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils libncurses-dev openjdk-11-jdk

Now it’s time to install Erlang.


# use vfox search get an avaliable version

❯ vfox search erlang

Please select a version of erlang [type to search]:

-> v25.0.4

v24.3.4.16

v24.1.3

v24.0

v24.3

v24.3.2

v25.2

v27.0-rc2

v24.3.4.1

Press ↑/↓ to select and press ←/→ to page, and press Enter to confirm

# you can also specific a version, eg:

vfox install erlang@26.2.2

Theoretically, you could install any version that appears in https://github.com/erlang/otp/releases. Since it is compiled and installed from source, the installation process will take some time. When you see the following message, the installation is complete.


compile info.......

...

Install erlang@26.2.2 success!

Please use vfox use erlang@26.2.2 to use it.

Let’s use vfox to switch to the Erlang/OTP version we just installed to verify that the installation is successful:


❯ vfox use erlang@26.2.2

Now using erlang@26.2.2.

❯ erl

Erlang/OTP 26 [erts-14.2.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

Eshell V14.2.2 (press Ctrl+G to abort, type help(). for help)

1>

If the REPL wakes up correctly, then install it. Let’s start installing Elixir.

Install Elixir

Because the installation of Elixir is also compiled and installed from the source code of the corresponding version, the compilation of Elixir needs to depend on Erlang, so we first let the current shell can find the Erlang just installed.


# switch shell to a Erlang version

❯ vfox use erlang@26.2.2

Now using erlang@26.2.2.

# install Elixir

> vfox install elixir@1.15.2

.........

.........

Generated ex_unit app

==> logger (compile)

Generated logger app

Generated eex app

==> iex (compile)

Generated iex app

Install elixir@1.15.2 success!

Please use vfox use elixir@1.15.2 to use it.

When you see Install elixir@1.15.2 success!, it means that the installation has been successful. The installation can be confirmed by IEX as a complete success:


❯ vfox use elixir@1.15.2

Now using elixir@1.15.2.

❯ iex

Erlang/OTP 26 [erts-14.2.2] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.15.2) - press Ctrl+C to exit (type h() ENTER for help)

iex(1)>

If you want to install a different version of Elixir, please make sure that the current version of Erlang/OTP is compatible with the version of Elixir, check this document to confirm compatibility: 《compatibility-and-deprecations.html#between-elixir-and-erlang-otp》

Set the global usage version

We can use vfox use -g xxx to set the version of Erlang and Elixir that we use by default.


> vfox use -g erlang@26.2.2

> vfox use -g elixir@1.15.2

# make sure setting succ

> cat ~/.version-fox/.tool-versions

erlang 26.2.2

elixir 1.15.2

The End

The two plugins for vfox to install and manage the Erlang/OTP and Elixir versions also support managing multiple versions under MacOS Darwin System. You can check out this document for more information: https://github.com/version-fox/vfox-elixir?tab=readme-ov-file#install-in-darwin-macos-13.

Happy & funny!

Most Liked

dimitarvp

dimitarvp

This is pretty nice, thanks for posting. I feel there really should have been a comparison with mise however, which is much faster than asdf and is fully compatible with its plugins.

dimitarvp

dimitarvp

It’s not only that it’s written in Rust (to me that’s an advantage as well). It’s that it doesn’t use shims and only manipulates $PATH instead, which removes overhead when starting any tool managed by it. (And asdf uses shims.)

Where Next?

Popular in Guides/Tuts Top

sergio
Hey there, we’re going to walk through deploying a Phoenix app to a DigitalOcean droplet, manually - no tools no nothing. Just straight u...
New
zazaian
I recently generated the boilerplate for a new mix app using the Phoenix 1.3.1 phx.new generator and realized that the structure of the w...
New
pinksynth
Whenever tests have to interact with an Ecto.Repo, sometimes it’s necessary to test a few different branches or paths that data can take....
New
9mm
So I’m really loving elixir. BY FAR the most excruciating piece of learning a functional language for me is having to “transform” all my ...
New
jshprentz
Geoffrey Lessel’s 2019 book, Phoenix in Action, was written for Phoenix 1.4. I found that the book’s code examples did not match the cur...
New
redfloyd
Greetings fellow alchemists ! I have started to write an open-source interpreter in Elixir (https://github.com/nicolasdilley/dwarf-inter...
New
OvermindDL1
Ran across this recently, it's a set of cheatsheet inforgraphic things of the OTP behaviours on the BEAM:
New
lukertty
Install web-mode and mmm-mode first and put this in your config file: (require 'mmm-mode) (require 'web-mode) (setq mmm-global-mode 'may...
New
bluegene
Hi guys, I’ve been on a personal journey to learn Elixir for the past two years. During this journey I’ve been using the spaced repetiti...
New
dennisreimann
I wrote a guide for implementing Passwordless Authentication a.k.a. "Magic Login Links": Feedback welcome!
New

Other popular topics Top

openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New

We're in Beta

About us Mission Statement