ASDF, the version manager for all your languages 
Tags: asdf, elixir, erlang, packagemanager
Published: 2019-05-13 16:54:19

---
title: ASDF, the version manager for all your languages 
published: true
description: a short guide to setting up the asdf package manager and then using it to install and enable versions of four programming languages
tags: asdf, Elixir, Erlang, Package Manager
canonical_url: https://alchemist.camp/episodes/asdf-language-versions
---

## Why use ASDF?
ASDF is a version manager for programming languages. It's somewhat like RVM is for Ruby or NVM is for Node but it also supports Erlang, Elixir, Haskel, Ocaml, PHP, Python, Rust and many other languages.

## Prereqs
This guide assumes you have homebrew and Xcode command line tools and nothing else. To see the setup of those from a fresh macOS Mojave install, see [this short video](https://youtu.be/Og4L5ijxqpA).

{% youtube YuOnN2bVeFY %}

## Clone the repo
The ASDF repo page on will have directions for cloning the newest repo github: https://github.com/asdf-vm/asdf

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

Next, add it to your shell:
```
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
```

Restart your shell (or just open a new tab to work from) and run `asdf` to verify that it's installed.

## Install the plugin dependencies

```
brew install \
  coreutils automake autoconf openssl \
  libyaml readline libxslt libtool unixodbc \
  unzip curl gpg wxmac
```

## Basic commands
 - `asdf plugin-list-all`: shows all the plugins (i.e., languages) available
 - `asdf plugin-add <language>`: installs *language*
 - `asdf list-all <language>`: shows all available versions of *language*
 - `asdf list <language>:` shows all installed versions of *language*
 - `asdf install <language> <version>`: 
 - `asdf current`: shows currently enabled languages
 - `asdf global <language> <version>`: enables the chosen version of a language


 ## Installing Node
Node requires an extra step:
```
bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring
asdf plugin-add nodejs
asdf list-all nodejs
asdf install nodejs <version>
asdf global nodejs <version>
```

 ## Installing Erlang
```
asdf plugin-add erlang
asdf list-all erlang
```

According the readme on [the ASDF Erlang plugin repo](https://github.com/asdf-vm/asdf-erlang) we need to pass a couple of flags to the install command:

```
export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac"
asdf install erlang <version>
asdf global erlang <version>
```

## Installing Elixir
```
asdf plugin-add elixir
asdf list-all elixir
asdf install elixir <version>
asdf global elixir <version>
```

## Installing Ruby
```
asdf plugin-add ruby
asdf list-all ruby
asdf install ruby <version>
asdf global ruby <version>
```

## Verify you have what you need
```
asdf current
```

## Installing the Phoenix Framework
If you're reading this on [Alchemist Camp](https://alchemist.camp), you're likely using ASDF for Elixir and also want to set up Phoenix:
```
mix local.hex
mix archive.install hex phx_new 1.4.5
```

## Done!
ASDF is a very handy tool for setting up dev machines and keeping the versions of whichever languages you may need. It's a big improvement to have one unified tool over several language specific ones.

ASDF also supports per-project configuration via `.tool-versions` files and a number of other things not covered in this setup guide.

*Originally published at [Alchemist Camp](https://alchemist.camp/episodes/asdf-language-versions)*