Here is the complete documentation for installing Java, Erlang (via Kerl), and Elixir (via Kiex) on Ubuntu and macOS, formatted in Markdown.
Runtimes: Java, Erlang (via Kerl), and Elixir (via Kiex)
Supported OS: Ubuntu (Debian-based) and macOS
Before installing the version managers, you need the build tools and libraries required to compile Erlang from source.
sudo apt update
sudo apt install -y build-essential autoconf m4 libncurses5-dev \
libwxgtk3.0-gtk3-dev libwxcommon-python3-nodist libssl-dev \
unixodbc-dev libasound2-dev libpulse-dev libssh-dev \
openjdk-17-jdk git curl
Ensure you have Homebrew installed:
brew install autoconf openssl@3 wxwidgets libtool coreutils curl
Erlang requires Java for certain components like the Java Interface (JInterface).
# Handled in prerequisites, but to install specifically:
sudo apt install -y openjdk-17-jdk
brew install openjdk
# Note: You may need to symlink it for the system to find it:
sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
kerl allows you to build and manage multiple Erlang/OTP installations.
curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
chmod a+x kerl
sudo mv kerl /usr/local/bin/
# Update release list
kerl update releases
# Build a specific version (e.g., 26.2.1)
# This takes a few minutes as it compiles from source
kerl build 26.2.1 26.2.1
# Install the build to a directory
mkdir -p ~/erlang/26.2.1
kerl install 26.2.1 ~/erlang/26.2.1
To use Erlang, you must source the activation script:
. ~/erlang/26.2.1/activate
Tip: Add this line to your .bashrc or .zshrc to make it permanent.
kiex provides an easy way to switch between Elixir versions.
curl -sSL https://raw.githubusercontent.com/taylor/kiex/master/install | bash -s
Add kiex to your shell profile (~/.bashrc or ~/.zshrc):
# Add this line
test -s "$HOME/.kiex/scripts/kiex" && source "$HOME/.kiex/scripts/kiex"
Then, reload your shell: source ~/.zshrc (or .bashrc).
# List available versions
kiex list releases
# Install a version (e.g., 1.16.0)
kiex install 1.16.0
# Set as default
kiex default 1.16.0
After installation, verify that all components are working correctly:
# Check Java
java -version
# Check Erlang (Inside the shell, type 'q().' to exit)
erl -version
# Check Elixir
elixir -v
| Task | Command |
|---|---|
| Switch Erlang | . ~/erlang/<version>/activate |
| Switch Elixir | kiex use <version> |
| List Installed Elixir | kiex list |
| List Built Erlang | kerl list installations |