Luke Oliff.

TIL: Installing Specific Tool Versions With asdf

·TIL·1 min read·Luke Oliff

Every project needs a different Node.js or Python version. asdf manages them all from one config file.

asdf plugin add nodejs
asdf install nodejs 18.16.0
asdf global nodejs 18.16.0

Add a plugin, install a version, set it as the default.

# .tool-versions
nodejs 18.16.0
python 3.11.3

A .tool-versions file at the project root pins every language version. cd into the project and asdf switches runtimes automatically.

asdf current

Shows which versions are active in the current directory.

Does asdf support .nvmrc and .python-version files?

Yes. asdf reads legacy version files if you enable the legacy_version_file option in ~/.asdfrc.

How is asdf different from nvm or pyenv?

asdf manages multiple languages from one tool instead of one tool per language. The config is a single .tool-versions file.