ASDF - Runtime Version Manager for Multiple Languages

ASDF

What is ASDF?

ASDF is an extendable version manager that allows you to manage multiple runtime versions with a single CLI tool. It is designed to be simple and easy to use, and it supports a wide range of programming languages and tools.

Installing ASDF

To install ASDF on your Mac, follow these steps:

  1. Open a terminal window.
  2. Run the following command to clone the ASDF repository:
Install ASDF
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.1
  1. Add the following line to your shell configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.bash_profile):
Add ASDF to shell configuration
. $HOME/.asdf/asdf.sh
  1. Restart your terminal or run the following command to apply the changes:
Apply changes to shell
source ~/.bashrc
  1. Verify that ASDF is installed correctly by running the following command:
Verify ASDF installation
asdf --version

If you see the ASDF version number, the installation was successful.

Using ASDF

To use ASDF, you need to install plugins for the programming languages or tools you want to manage. For example, to install the Node.js plugin, run the following command:

Install Node.js plugin
asdf plugin-add nodejs

After installing the plugin, you can install specific versions of Node.js using ASDF. For example, to install Node.js version 14.17.0, run the following command:

Install Node.js version 14.17.0
asdf install nodejs 14.17.0

You can switch between different versions of Node.js using the asdf local command. For example, to use Node.js version 14.17.0 in the current directory, run the following command:

Use Node.js version 14.17.0
asdf local nodejs 14.17.0

Switching between Python versions

To switch between Python versions using ASDF, follow these steps:

  1. Install the Python plugin by running the following command:
Install Python plugin
asdf plugin-add python
  1. Install the desired Python version using the following command:
Install Python version
asdf install python 3.10.7
  1. Set the Python version to use in the current directory by running the following command:
Use Python version
asdf local python 3.10.7

Now you can use the specified Python version in the current directory.

Conclusion

ASDF is a powerful version manager that simplifies the process of managing multiple runtime versions. By following the steps outlined in this guide, you can install ASDF on your Mac and start using it to manage different programming languages and tools with ease. If you have any questions or run into any issues, feel free to consult the official ASDF documentation.