Logo

dev-resources.site

for different kinds of informations.

Installing Erlang With vfox

Published at
4/26/2024
Categories
vfox
erlang
asdf
Author
yeshan333
Categories
3 categories in total
vfox
open
erlang
open
asdf
open
Author
9 person written this
yeshan333
open
Installing Erlang With vfox

vfox (version fox) is a cross-platform, extensible version manager. It supports native Windows, and of course Unix-like! With it, you can quickly install and switch different environment.

Recently, I have wrote some plugins for vfox. The vfox-erlang plugin is one of them. I really like the plugin management mechanism of vfox (Based on Lua). You can use the vfox-erlang plugin to quickly manage mutiple Erlang/OTP version on your machine.

I have used a similar tool asdf before, but the previous experience of using asdf was not very good (I don’t mean to step on it~, the ASDF ecosystem is very strong), vfox now supports a lot of plugins, and can already manage the versions of most common mainstream languages.

vfox's version management workflow is generally similar to asdf, but with a bit better performance (about 5x), since asdf is written in shell at its core. The official documentation also gives a benchmark, see 《Comparison with asdf-vm》:

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

vfox, like asdf, can be configured globally and project level tool version via the .tool-version configuration file, which means that if you switch from asdf to vfox, it's quite convenient.

Using vfox-erlang

This article mainly describes how to use the vfox-erlang plugin to manage multiple Erlang/OTP versions on the same machine. It is also common to have multiple versions of Erlang/OTP for testing and comparison in the same development environment.

At present, the actual installation process of the vfox-erlang plug-in implementation is to compile and install Erlang/OTP from the GitHub source code, so for the time being, it only supports the installation and management of Erlang/OTP versions on Unix-like systems (such as ubuntu, macos darwin, etc.) (the windows exe installer is actually provided by the official site, but recently I haven't had enough time to perfect the plug-in implementation, and the scenarios of using Erlang in windows are generally relatively few).

Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang's runtime system has built-in support for concurrency, distribution and fault tolerance.
OTP is set of Erlang libraries and design principles providing middle-ware to develop these systems. It includes its own distributed database, applications to interface towards other languages, debugging and release handling tools.
from site: https://www.erlang.org/

Install the vfox and vfox-erlang plugin

Before using vfox-erlang to manage Erlang/OTP versions, please make sure that you have installed vfox on your machine, you can refer to the official Quick Start documentation, this article takes Ubuntu 20.04 as an example.

# install vfox via apt
echo "deb [trusted=yes] https://apt.fury.io/versionfox/ /" | sudo tee /etc/apt/sources.list.d/versionfox.list
sudo apt-get update -y
sudo apt-get install vfox -y

# Hook vfox to your Shell, let vfox found the Erlang/OTP version
echo 'eval "$(vfox activate bash)"' >> ~/.bashrc

# add vfox-erlang plugin, plugin is generally installed in the ~/.version-fox/plugin/erlang directory
vfox add erlang
Enter fullscreen mode Exit fullscreen mode

Install the specified version of Erlang/OTP via plugin

Since Erlang/OTP is compiled and installed from source, we need to have the corresponding build toolchain and dependent software, here is an example of Ubuntu 20.04:

# install require utils
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
Enter fullscreen mode Exit fullscreen mode

and then we can then manage the installation of multiple Erlang/OTP versions via vfox.

# search a avaliable Erlang/OTP version to install
❯ vfox search erlang
Please select a version of erlang [type to search]: 
->  v25.3.2.5
   v24.0-rc3
   v24.3
   v23.3.4.18
   v24.0.6
   v24.3.2
   v25.3
   v24.1.4
   v26.0.2
Enter fullscreen mode Exit fullscreen mode
# or you can also specific version
> vfox install [email protected]
...
Install [email protected] success! 
Please use vfox use [email protected] to use it.
Enter fullscreen mode Exit fullscreen mode

When you see something like Install erlang@xxx success! information. It mean the the installation is complete. Next, you can use the vfox use command to switch Erlang/OTP version, so that the current shell session can use the corresponding Erlang/OTP version.

# use the specific Erlang/OTP version
vfox use [email protected]
Enter fullscreen mode Exit fullscreen mode

vfox use demo

vfox provides three perspectives of version management: current shell session level, project level, global level, through a .tool-versions can flexibly assign different Erlang/OTP versions to different project directories, More information can be found in the official documentation: vfox-Switch runtime..

The usage examples in this article are mainly based on Linux systems, but the user documentation of vfox-erlang also gives the user guide install-in-darwin-macos-13 under MacOS Darwin, and provides continuous integration testing under Linux and MacOS for reference: vfox-erlang E2E testing. vfox-erlang E2E testing.

e2e testing

Happy and funny~

erlang Article's
30 articles in total
Favicon
Elixir em Foco em 2024
Favicon
Parsing Grid-Based STDIN Input in Gleam
Favicon
Bridging the Gap: Simplifying Live Component Invocation in Phoenix LiveView
Favicon
RabbitMQ with Web MQTT Plugin vs. Node.js : Performance and Memory Usage Comparison
Favicon
Navigating the EEF Stipend Process
Favicon
👉 What is gleam language used for ❓
Favicon
Implementing OpenID Connect on the BEAM
Favicon
OpenID Connect—An Introduction
Favicon
Por que o Elixir Ă© melhor que Node.js para Processamento AssĂ­ncrono?
Favicon
How To Deploy RabbitMQ On Public IP?
Favicon
Weather API: A GenServer and LiveView Implementation Part I
Favicon
Berkenalan Dengan Bahasa Pemrograman Fungsional Elixir (Bagian 1)
Favicon
(Amazing!) How to manage and install multiple versions of Erlang/OTP and Elixir via vfox in Windows
Favicon
Hands-On with Gleam: Building and Improving a Binary Search Tree
Favicon
Historia de la BeamVM
Favicon
Elixir Days - Evento presencial em SĂŁo Paulo
Favicon
BEAM VM The good, the bad and the ugly
Favicon
ConferĂŞncias do Ecossistema de Erlang (e Elixir)
Favicon
Deep Diving Into the Erlang Scheduler
Favicon
Install mutiple Erlang and Elixir with vfox
Favicon
Installing Erlang With vfox
Favicon
Erlang Workshop 2024 - Call for Papers
Favicon
Empresas brasileiras que usam, ou usaram, Elixir ou Erlang
Favicon
Binary Data in Gleam: Implementing The RCON Protocol
Favicon
Using the Keyword module for options
Favicon
How to take leverage from on_mount to reduce code
Favicon
What you should know about the live_session macro
Favicon
Build Phoenix Docker Compose development environment easily
Favicon
When to use the handle_params callback
Favicon
The “let it crash” error handling strategy of Erlang, by Joe Armstrong

Featured ones: