Managing programming language environments is a frequent challenge in software development, as projects often demand specific language versions to be present on the system. asdf is a CLI tool that aims to simplify this process.
This article will show you how to install and use asdf to manage multiple development environments.

Prerequisites
- Git installed.
- Administrative system access.
What Is asdf?
asdf is an extensible version manager for handling multiple runtime versions on a per-project basis. It serves as a universal installer and switcher for languages such as Python, Ruby, Node.js, and Elixir. Unlike language-specific version managers (e.g., nvm for Node.js or rvm for Ruby), asdf provides a unified approach.
The tool operates via plugins installed for each language. Plugins enable asdf to download, install, and switch between different versions of a language as needed without conflicting with other projects.
How to Install asdf
The easiest way to install asdf is to download the binary and add the tool to the shell. Follow the procedure described in the sections below to install asdf on Ubuntu.
Step 1: Download asdf
Use the following steps to download the asdf binary:
1. Go to the Releases section on the official asdf GitHub page and find the binary for your system.
2. Right-click the download link and select Copy Link.
3. Use the curl command to download the archive file:
curl -LO https://github.com/asdf-vm/asdf/releases/download/v0.17.0/asdf-v0.17.0-linux-amd64.tar.gz
Step 2: Untar Archive
Untar the archive by entering the command below:
sudo tar -xvzf [archive_name].tar.gz -C /usr/local/bin
For example:
sudo tar -xvzf asdf-v0.17.0-linux-amd64.tar.gz -C /usr/local/bin
The command uncompresses the binary and places it in the /usr/local/bin directory on the system.
Step 3: Verify Installation
Use the following type
command to test if the binary was installed correctly:
type -a asdf
The output shows the location of the asdf binary.
Configure Shell
Add asdf to the shell's configuration file to integrate it into the environment and allow the shell to locate and execute asdf
commands.
The sections below explain how to configure asdf in Bash and Zsh.
Configure Bash
Follow the steps below to edit the .bashrc file and add asdf completions to the Bash shell:
1. Open .bashrc in a text editor, such as Nano:
nano ~/.bashrc
2. Add the following line to the file:
. <(asdf completion bash)
3. Save the file and exit.
4. Apply the changes with the source command:
source ~/.bashrc
Configure Zsh
Use the following steps to configure Zsh to work with asdf:
1. Create a directory for asdf completions:
mkdir -p "${ASDF_DATA_DIR:-$HOME/.asdf}/completions"
2. Type the following command to generate a completion script and put it in the completions directory:
asdf completion zsh > "${ASDF_DATA_DIR:-$HOME/.asdf}/completions/_asdf"
3. Open the .zhsrc file in a text editor:
nano ~/.zshrc
4. Add the following lines to the file:
fpath=(${ASDF_DATA_DIR:-$HOME/.asdf}/completions $fpath)
autoload -Uz compinit && compinit
5. Save the file and exit.
6. Apply the changes:
source ~/.zshrc
How to Configure asdf?
Once asdf is installed, configure it by adding plugins for the desired languages and tools. Refer to the sections below for specific configuration steps.
Add Language Plugins
To manage a specific language or tool, add its corresponding plugin with the command below:
asdf plugin add [language] [github_link_to_plugin]
For instance, type the following command to add the Node.js plugin:
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
A list of available plugins is in the asdf-plugins repository.
Install Language Versions
After adding a plugin for a language, install specific versions of that language. Use the following command to add a language version:
asdf install [language] [version]
For example, to install Node.js version 18.17.1, type the command below:
asdf install nodejs 18.17.1
Alternatively, to install the latest stable version, enter the following:
asdf install nodejs latest
Set Version
asdf allows users to set a version for each project separately. Set a language version by executing the command below in the project directory:
asdf set [language] [version]
For example, to set Node.js 18.17.1, type the following:
asdf set nodejs 18.17.1
The command creates a .tool-versions file in the directory. The version set in this file also applies to all the subdirectories unless the user executes another asdf set
command in a subdirectory.
Note: Tools without a specified version will fail to execute. Use asdf current
to see which tools in your directory have a version resolved. The command informs the user if a version is missing, helping identify potential failures.
Conclusion
This tutorial showed you how to install and set up the asdf version manager on your system. The article included instructions for configuring asdf to work with the local environment and different programming language versions.
Next, learn how to check the Python version on different operating systems.