[go: up one dir, main page]

DEV Community

Pablo Grant
Pablo Grant

Posted on • Edited on

Quickly install elixir using asdf

ASDF is a cli used to manage the installation and runtime versions of several popular languages. I've recently found out about asdf, and used it to run a quick update on my local machine. This article will provide a quick tutorial on the installation and update process.

1. Install ASDF.

To install asdf, first clone the most recent stable release from the github repository:

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.8

Then, add it as an environment variable to bash

echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc

2. Install Erlang and Elixir

You can then install any language from these list of plugins. We will be installing the most recent version of erlang and elixir using these plugins.

Install erlang:

asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git

Install elixir:

To install elixir, the installation instructions dictate you must have unzip installed first. Run the following commands
sudo apt install unzip && asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git

Optional: Install hex and rebar.

You can install hex and rebar by running the following command
mix local.hex --if-missing --force && mix local.rebar --if-missing --force

Final: Set up your .tool-versions.

The .tool-versions file is the file which asdf uses to determine which installed version of the language your project uses. U can set up a global .tool-versions for asdf to fall back on if your current folder doesn't have a .tool-versions present. Run the following command.

echo -e '\n elixir 1.10.2 \n mix 1.10.2' >> $HOME/.tool-versions

Top comments (0)