ASDF - The Multiple Runtime Version Manager

Support the development of the website

This website was created to provide useful and free information to the community. To maintain and develop it, we need support from you.

If you find the website valuable, you can contribute any amount, whether it's $1 or $2, to help keep it running. Your contribution will help cover operating costs, maintenance, and content improvement. Every donation is greatly appreciated and will help us grow sustainably.

Thank you sincerely for your support!
ASDF - The Multiple Runtime Version Manager
ASDF manages multiple versions of programming tools on one system. It ensures consistency across teams, simplifies version management, allows project-specific configs, and auto-switches environments. It's a single tool replacing multiple version managers, reducing conflicts and "works on my machine" issues.

What is asdf?

ASDF is a tool version manager. It allows developers to manage multiple versions of different programming languages, runtimes, and other development tools on a single system.

Fun fact: The name "asdf" comes from the first four letters on the left side of your keyboard. Try finding them!

Homepage: https://asdf-vm.com/

Key Features

  1. Single Configuration File: ASDF uses a .tool-versions file to specify the versions of all tools used in a project.
  2. Version Control Friendly: The .tool-versions file can be committed to version control systems like Git, ensuring all team members use the same tool versions.
  3. Plugin-based Architecture: ASDF can be extended to support various tools through plugins.

How It Works

  1. Shell Integration: ASDF integrates with your shell (like Bash or Zsh) to intercept commands.
  2. Plugins: Each tool (like Python, Node.js, etc.) is managed by a plugin.
  3. Shims: When you install a tool version, ASDF creates shims for its executables.
  4. Version Selection: When you run a command, ASDF checks the .tool-versions file and executes the specified version of the tool.

Advantages over Traditional Methods

  1. Consistency: Ensures all developers use the same tool versions, reducing "it works on my machine" issues.
  2. Simplicity: One tool to manage all version-specific dependencies, instead of using multiple version managers.
  3. Project-specific Configurations: Different projects can use different tool versions without conflicts.
  4. Automatic switching: You don't need to manually activate/deactivate environments as you switch between projects.

Example scenario

Let's say you have Python 3.8 and 3.9 installed via asdf, and your project's .tool-versions specifies Python 3.9.5.

  1. You cd into your project directory.
  2. You type python in the terminal.
  3. The asdf shim for Python is executed.
  4. Asdf reads the .tool-versions file.
  5. It sees that Python 3.9.5 is specified for this project.
  6. Asdf then runs the Python 3.9.5 executable.

This process happens transparently and quickly, so it feels like you're just running Python normally.

Installing asdf on Ubuntu: A Step-by-Step Guide

Prepare Your System: First, ensure your system is up-to-date:

$ sudo apt update && sudo apt upgrade

Install required dependencies:

$ sudo apt install curl git

Install asdf:

$ cd ~ && git clone https://github.com/asdf-vm/asdf.git ~/.asdf

Add the following to ~/.bashrc or ~/.zshrc:

. "$HOME/.asdf/asdf.sh"

Restart your shell or source the configuration file

Verify installation:

$ asdf --version

Using asdf on Ubuntu: A Step-by-Step Guide

Add a plugin:

$ asdf plugin add  []
# asdf plugin add nodejs

List All Available Versions:

$ asdf list all 
# asdf list all nodejs

Install a version:

$ asdf install  
# asdf install nodejs 18.0.0

List Installed Versions:

$ asdf list 
# asdf list nodejs

Set a local version (in current directory):

$ asdf local  
# asdf local nodejs 18.0.0

local writes the version to $PWD/.tool-versions, creating it if needed.

 

Support the development of the website

This website was created to provide useful and free information to the community. To maintain and develop it, we need support from you.

If you find the website valuable, you can contribute any amount, whether it's $1 or $2, to help keep it running. Your contribution will help cover operating costs, maintenance, and content improvement. Every donation is greatly appreciated and will help us grow sustainably.

Thank you sincerely for your support!