kerl
Manage Erlang/OTP versions
TLDR
Build and install an Erlang/OTP version in a directory
Activate an Erlang/OTP installation
Deactivate the current Erlang/OTP installation
List all available Erlang/OTP releases
List installed Erlang/OTP builds
SYNOPSIS
kerl command [options] [arguments]
PARAMETERS
update releases
Fetches and updates the list of available Erlang/OTP release versions from the official repositories.
build release_name build_name
Compiles a specified Erlang/OTP release (e.g., 24.3) and assigns it a unique build name. Environment variables like KERL_CONFIGURE_OPTIONS can be set for custom build configurations.
install build_name install_path
Installs a previously built Erlang/OTP version into the specified install_path, making it ready for use.
list builds
Displays a list of all Erlang/OTP versions that have been successfully built and are available for installation.
list releases
Shows all available Erlang/OTP release versions that kerl can fetch and build.
active
Reports the currently active Erlang/OTP installation path within the shell session.
use install_path
Activates a specific Erlang/OTP installation by setting environment variables (PATH, ERL_LIBS) in the current shell session.
shell
Starts an Erlang shell (erl) using the currently active Erlang/OTP installation.
cleanup
Removes old build directories and source archives to free up disk space, while keeping installed versions intact.
DESCRIPTION
kerl is a powerful shell script designed to simplify the process of building and managing multiple Erlang/OTP installations on a single system. It automates fetching Erlang/OTP source code from official repositories, configuring, compiling, and installing various Erlang versions in isolated environments. This allows developers to easily switch between different Erlang releases for project-specific needs without conflicts, ensuring that each project can run with its required Erlang version. Beyond simple installation, kerl handles common dependencies like `autoconf`, `make`, and `gcc`, providing a streamlined workflow for Erlang development. It's particularly useful for maintaining environments where different applications require specific Erlang/OTP versions, ensuring compatibility and reproducibility across diverse development and production setups. The tool promotes a clean and organized approach to Erlang version management, preventing global `PATH` pollution and facilitating testing across versions.
CAVEATS
kerl requires standard build tools such as `gcc`, `make`, `autoconf`, and `m4` to be installed on the system. Network access is essential to download Erlang/OTP source code. Custom build options (e.g., enabling `wx`, `odbc`, `ssl` applications) often necessitate additional system libraries and their development headers to be present before compilation. It primarily manages Erlang/OTP itself and does not handle individual Erlang application dependencies, for which tools like `rebar3` or `mix` are typically used.
ENVIRONMENT VARIABLES
kerl leverages several environment variables to customize its behavior and the Erlang build process. For instance, setting KERL_BUILD_DOCS=yes before a `build` command will include documentation in the installation. Similarly, KERL_CONFIGURE_OPTIONS="--enable-threads --enable-smp-support --without-javac" allows passing specific flags directly to the Erlang configure script, providing fine-grained control over the compilation and included features.
INTEGRATION WITH SHELL
To permanently activate a specific Erlang installation or make kerl commands available across shell sessions, users commonly source the `kerl_builds/kerlrc` file or add the kerl executable's directory to their PATH in their shell's startup file (e.g., .bashrc, .zshrc). The `use` command, on the other hand, dynamically sets up the necessary PATH and ERL_LIBS variables for the current shell session only, allowing temporary switching between Erlang versions.
HISTORY
kerl was originally created by José Valim to simplify the often-cumbersome process of building and switching between Erlang versions, addressing common frustrations with manual compilation and path management. Its development aimed to provide a reliable and easy-to-use tool for Erlang developers. It rapidly gained popularity within the Erlang and Elixir communities, establishing itself as a de-facto standard for managing Erlang environments, particularly for development setups and CI/CD pipelines. Its design as a lightweight, highly portable shell script has contributed significantly to its widespread adoption and ease of integration into various workflows.