How To Install Erlang on Manjaro

Erlang stands as one of the most powerful functional programming languages for building concurrent, distributed, and fault-tolerant systems. Manjaro Linux, with its rolling-release model and access to vast software repositories, provides an excellent environment for Erlang development. Installing Erlang on Manjaro offers multiple pathways depending on specific requirements, from simple package manager installations to building from source code.
This comprehensive guide walks through four proven methods for installing Erlang on Manjaro Linux. Whether working on telecommunications applications, real-time systems, or distributed computing projects, these installation approaches cover every scenario from beginners to advanced developers.
What is Erlang?
Overview of Erlang Programming Language
Erlang represents a general-purpose concurrent functional programming language developed by Ericsson in the mid-1980s. Originally designed for telecommunications switching systems, Erlang has evolved into a robust platform for building scalable applications. The language runs on the BEAM (Bogdan/Björn’s Erlang Abstract Machine) virtual machine, which provides exceptional concurrency handling capabilities. Erlang’s runtime system enables developers to create applications that process thousands of simultaneous tasks without performance degradation.
Key Features of Erlang
Erlang incorporates several distinctive features that set it apart from conventional programming languages. Built-in concurrency support allows spawning millions of lightweight processes that communicate through message passing. The “let it crash” philosophy embraces failure as an expected part of system operation, using supervisor processes to restart failed components automatically. Hot code swapping enables updating running systems without downtime, crucial for telecommunications and mission-critical applications. Pattern matching provides elegant syntax for destructuring data structures and controlling program flow. Distributed computing support allows processes to run across multiple machines transparently.
Common Use Cases
Erlang powers critical infrastructure across multiple industries. WhatsApp built its messaging platform serving billions of users on Erlang. Financial institutions leverage Erlang for trading systems requiring millisecond-level latency. E-commerce platforms use it for handling massive concurrent user sessions. IoT applications benefit from Erlang’s lightweight process model. Distributed databases like Riak and CouchDB utilize Erlang for data distribution and replication.
Prerequisites for Installing Erlang on Manjaro
Before beginning the installation process, ensure the system meets necessary requirements. A working Manjaro Linux installation on any desktop environment (KDE Plasma, XFCE, or GNOME) provides the foundation. Terminal access enables executing installation commands. Sudo or root privileges allow installing system packages. An active internet connection facilitates downloading required files.
Check the current Manjaro version and update existing packages:
cat /etc/os-release
sudo pacman -Syu
This command updates the package database and upgrades all installed software to their latest versions. Basic familiarity with Linux terminal commands streamlines the installation process. Git installation becomes necessary for certain methods like ASDF version manager.
Method 1: Install Erlang Using Pacman (Recommended)
Step 1: Update System Repositories
Keeping repository databases current ensures access to the latest package information. Execute this command to refresh package lists:
sudo pacman -Sy
For a complete system upgrade including packages, use:
sudo pacman -Syu
The system downloads updated package databases from configured mirrors. This step prevents installation failures due to outdated repository information.
Step 2: Install Erlang from Official Repositories
Manjaro’s official repositories contain pre-compiled Erlang packages maintained by the Arch Linux community. Install Erlang with a single command:
sudo pacman -S erlang
The package manager displays a list of dependencies required for Erlang. Press Enter to confirm installation. The erlang package includes the complete Erlang/OTP platform with compiler, runtime system, and standard libraries. Installation typically requires 100-200 MB of disk space depending on dependencies.
Step 3: Confirm Installation
During installation, pacman displays progress information including download speeds and package verification. The process completes within minutes on modern systems. Successful installation returns to the command prompt without errors.
Advantages of Using Pacman
The official package manager method offers significant benefits. Packages receive regular security updates through the standard system update process. Dependency resolution happens automatically without manual intervention. Integration with Manjaro’s package ecosystem ensures compatibility with other installed software. Stable, tested versions reduce the risk of unexpected bugs. Removal and management remain straightforward through familiar pacman commands.
Method 2: Install Erlang Using Yay AUR Helper
What is Yay?
Yay (Yet Another Yogurt) serves as an AUR helper that simplifies installing packages from the Arch User Repository. The AUR contains community-maintained packages not available in official repositories. Yay provides a pacman-like interface for searching, installing, and updating AUR packages. This tool proves invaluable for accessing cutting-edge software versions and specialized Erlang variants.
Step 1: Install Yay (If Not Already Installed)
Many Manjaro installations include Yay by default. Verify installation with:
yay --version
If Yay is not installed, add it using:
sudo pacman -S yay
Alternatively, build Yay from source using these commands:
sudo pacman -S git base-devel
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
Step 2: Search for Erlang Packages in AUR
Explore available Erlang packages in the AUR:
yay -Ss erlang
This command lists various Erlang-related packages including different versions and variants. The output shows package names, descriptions, and version numbers.
Step 3: Install Erlang via Yay
Install Erlang from AUR repositories:
yay -S erlang
Yay displays build information and prompts for confirmation. The tool downloads source files, compiles the package, and installs it automatically. This process takes longer than binary package installation since compilation occurs locally.
Step 4: Manage AUR Package Updates
Update all AUR packages including Erlang:
yay -Syu
This command checks for updates to both official repository packages and AUR packages. Regular updates maintain security and access new features.
When to Use Yay Instead of Pacman
AUR packages provide access to the latest Erlang releases before they reach official repositories. Development versions and release candidates become available for testing new features. Specific Erlang variants like erlang-nox (without X11 dependencies) suit server environments. Custom build configurations allow optimization for particular use cases.
Method 3: Install Erlang Using ASDF Version Manager
What is ASDF?
ASDF functions as a universal version manager supporting multiple programming languages including Erlang, Elixir, Node.js, and Ruby. This tool enables managing different language versions simultaneously on the same system. Per-project version specifications ensure applications run with compatible language versions. ASDF eliminates version conflicts in development environments.
Step 1: Install ASDF on Manjaro
Clone the ASDF repository to the home directory:
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0
Add ASDF to the shell configuration. For Bash users, append to ~/.bashrc:
echo '. ~/.asdf/asdf.sh' >> ~/.bashrc
echo '. ~/.asdf/completions/asdf.bash' >> ~/.bashrc
For Zsh users, modify ~/.zshrc:
echo '. ~/.asdf/asdf.sh' >> ~/.zshrc
Reload the shell configuration:
source ~/.bashrc
Or for Zsh:
source ~/.zshrc
Step 2: Install ASDF Erlang Plugin
Add the Erlang plugin to ASDF:
asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git
This plugin enables ASDF to download, compile, and manage Erlang versions.
Step 3: Install Build Dependencies
Erlang compilation requires several development libraries. Install necessary dependencies:
sudo pacman -S base-devel ncurses openssl wxwidgets unixodbc fop libxslt
These packages provide essential tools for compiling Erlang from source. The ncurses library enables terminal interfaces. OpenSSL supports cryptographic functions. wxWidgets provides GUI toolkit functionality.
Step 4: List Available Erlang Versions
View all installable Erlang versions:
asdf list-all erlang
The output displays numerous versions from older releases to the latest stable builds. Choose versions based on project requirements or compatibility needs.
Step 5: Install Specific Erlang Version
Install a particular Erlang version:
asdf install erlang 27.0
Replace 27.0 with the desired version number. Compilation takes 10-30 minutes depending on system specifications. The process downloads source code, configures build options, and compiles all components.
Step 6: Set Global Erlang Version
Configure the default Erlang version system-wide:
asdf global erlang 27.0
For project-specific versions, navigate to the project directory and set a local version:
asdf local erlang 26.2
This creates a .tool-versions file specifying the Erlang version for that project.
Benefits of Using ASDF
ASDF excels in development environments requiring multiple language versions. Testing applications across different Erlang releases ensures compatibility. Team members maintain consistent development environments through shared .tool-versions files. Switching between versions happens instantly without reinstallation. Legacy project maintenance becomes simpler when older Erlang versions remain accessible.
Method 4: Building Erlang from Source
When to Build from Source
Compiling Erlang from source suits specific scenarios. Custom build configurations enable optimizing for particular hardware architectures. Enabling or disabling specific features tailors Erlang to exact requirements. Accessing unreleased versions facilitates testing cutting-edge features. Patching source code addresses specific bugs or adds custom functionality.
Step 1: Install Build Dependencies
Comprehensive dependency installation ensures successful compilation:
sudo pacman -S gcc make perl ncurses openssl wxwidgets mesa glu unixodbc fop libxslt apache-ant
Additional dependencies may be required for optional features. Java support needs JDK installation. Documentation building requires fop and libxslt.
Step 2: Download Erlang Source Code
Visit the official Erlang website to download source archives. Navigate to the downloads section and select the desired version. Download using wget:
wget https://github.com/erlang/otp/releases/download/OTP-28.1/otp_src_28.1.tar.gz
Extract the archive:
tar -xzf otp_src_28.1.tar.gz
cd otp_src_28.1
Step 3: Configure Build Options
Execute the configure script with preferred options:
./configure --prefix=/usr/local
The prefix option specifies the installation directory. Additional flags customize the build:
./configure --prefix=/usr/local --enable-threads --enable-smp-support --enable-kernel-poll
These options enable threading, symmetric multiprocessing support, and kernel poll optimization.
Step 4: Compile and Install
Begin compilation:
make
This process takes 15-45 minutes depending on system performance. Multiple CPU cores accelerate compilation. After successful compilation, install Erlang:
sudo make install
The installation copies binaries, libraries, and documentation to specified directories.
Step 5: Verify Custom Installation
Check the installation path:
which erl
Add the installation directory to PATH if necessary:
export PATH=/usr/local/bin:$PATH
Make this permanent by adding to ~/.bashrc or ~/.zshrc.
Verifying Erlang Installation
Check Erlang Version
Confirm successful installation by checking the version:
erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell
This command displays the Erlang/OTP release number. A simpler verification method:
erl -version
Verify Erlang Shell
Start the Erlang REPL (Read-Eval-Print Loop):
erl
The shell displays version information and presents a prompt:
Erlang/OTP 27 [erts-15.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
Eshell V15.0 (press Ctrl+G for shell REPL help)
1>
This confirms Erlang installed correctly and runs properly.
Test Basic Erlang Commands
Execute simple calculations in the Erlang shell:
1> 2 + 3.
5
2> 10 * 5.
50
Note the period (.) at the end of each expression. Try list operations:
3> [1, 2, 3, 4, 5].
[1,2,3,4,5]
Exit the shell:
4> halt().
Alternatively, press Ctrl+C twice to exit.
Getting Started with Erlang on Manjaro
Understanding the Erlang Shell (REPL)
The Erlang shell provides an interactive environment for testing code. Commands execute immediately without compilation. Variables bind once and remain immutable. The shell remembers previous expressions through numbered references.
Creating Your First Erlang Program
Create a file named hello.erl:
-module(hello).
-export([world/0]).
world() ->
io:fwrite("Hello, World!\n").
This module defines a function that prints a greeting. The -module directive specifies the module name matching the filename. The -export directive makes functions available externally.
Compiling Erlang Code
Compile the module using the Erlang compiler:
erlc hello.erl
This generates a hello.beam file containing bytecode. The BEAM virtual machine executes these compiled files.
Running Erlang Programs
Start the Erlang shell and load the compiled module:
erl
1> hello:world().
Hello, World!
ok
Alternatively, run directly from the command line:
erl -noshell -s hello world -s init stop
Essential Erlang Packages and Tools
Erlang Package Components
The main Erlang package includes numerous components. The erlang-core provides essential runtime libraries. Individual packages like erlang-asn1, erlang-crypto, and erlang-ssl offer specialized functionality. Manjaro splits some components into separate packages for modular installation.
Recommended Development Tools
Rebar3 serves as the standard build tool for Erlang projects. Install it through pacman:
sudo pacman -S rebar
Observer provides a graphical interface for monitoring running Erlang systems. Launch it from the Erlang shell:
1> observer:start().
Dialyzer performs static analysis detecting type errors and dead code:
dialyzer --build_plt --apps erts kernel stdlib
Installing Additional Erlang Packages
Search for Erlang-related packages:
pacman -Ss erlang
Install specific components as needed:
sudo pacman -S erlang-odbc
Popular Frameworks and Libraries
Elixir, a functional language built on Erlang, shares the same virtual machine. Phoenix framework provides web development capabilities. Cowboy serves as a lightweight HTTP server. RabbitMQ implements message queuing using Erlang.
Updating and Managing Erlang
Updating Erlang via Pacman
Keep Erlang current with system updates:
sudo pacman -Syu
Check specifically for Erlang updates:
pacman -Qu | grep erlang
Updating via Yay
Update AUR packages:
yay -Syu
This checks both official repositories and AUR packages for available updates.
Switching Versions with ASDF
List installed Erlang versions:
asdf list erlang
Change the global version:
asdf global erlang 26.2
Set project-specific versions:
cd /path/to/project
asdf local erlang 27.0
Uninstalling Erlang
Remove Erlang installed via pacman:
sudo pacman -R erlang
For complete removal including dependencies:
sudo pacman -Rns erlang
Uninstall ASDF Erlang versions:
asdf uninstall erlang 27.0
Remove all ASDF Erlang installations:
asdf plugin remove erlang
Troubleshooting Common Issues
“Target not found” Error
This error indicates the package manager cannot locate the requested package. Update mirror lists:
sudo pacman-mirrors -f 5 && sudo pacman -Syyu
This command selects the five fastest mirrors and updates databases. Clear the package cache if issues persist:
sudo pacman -Sc
Build Failures with ASDF
Compilation errors often result from missing dependencies. Review error messages carefully for missing libraries. Install additional dependencies:
sudo pacman -S autoconf
OpenSSL compatibility issues affect older Erlang versions. Specify OpenSSL path during installation:
KERL_CONFIGURE_OPTIONS="--with-ssl=/usr/bin/openssl" asdf install erlang 24.3
Permission Denied Errors
Incorrect permissions prevent installation. Ensure proper sudo usage for system-wide installations. User-specific installations avoid permission issues:
./configure --prefix=$HOME/erlang
Erlang Shell Won’t Start
PATH configuration problems prevent finding the Erlang binary. Verify installation location:
which erl
Add to PATH if necessary:
export PATH=$PATH:/usr/local/bin
Check for conflicting installations:
whereis erl
Package Conflicts
Manjaro occasionally reorganizes packages creating conflicts. The erlang-nox package merged into erlang in recent updates. Remove conflicting packages:
sudo pacman -R erlang-nox
sudo pacman -S erlang
Version Compatibility Issues
Applications built with specific Erlang versions may require matching installations. Check requirements in project documentation. Elixir versions depend on particular Erlang releases. Verify compatibility matrices on official websites.
Best Practices for Erlang Development on Manjaro
Choosing the Right Installation Method
Beginners benefit from pacman installations providing simplicity and reliability. Development environments suit ASDF for managing multiple versions. Production servers prefer stable pacman releases with automated security updates. Experienced developers building from source gain customization flexibility.
Keeping Your System Updated
Manjaro’s rolling release model delivers continuous updates. Regular system updates maintain security:
sudo pacman -Syu
Schedule weekly updates minimizing vulnerability windows. Test updates in development environments before applying to production systems.
Development Environment Setup
Visual Studio Code supports Erlang through extensions. Install the Erlang extension for syntax highlighting and IntelliSense. Vim users leverage erlang-vim plugins. Emacs provides Erlang mode out of the box. Configure language servers for advanced IDE features.
Congratulations! You have successfully installed Erlang. Thanks for using this tutorial for installing the latest version of Erlang programming language on Manjaro Linux. For additional help or useful information, we recommend you check the official Erlang website.