Skip to content

asdf

Asdf is an all-in-one tool manager designed to replace individual language specific version managers such as pyenv, nvm, rbenv, etc. Asdf operates on a plugin based system to support the different tools. A full list of the supported plugins can be found here https://github.com/asdf-community. Asdf uses shims similar to pyenv, nvm, etc. and has the ability to install a tool globally, within a specific directory, or within a shell.

Installing a tool with asdf is a multistep process:

  1. Install asdf
  2. Install the plugin corresponding to the desired language/tool (ex: nodejs, golang, python, etc…) asdf plugin add <name>
  3. Install the desired version of the language/tool asdf install <name> <version>
  4. Load the language/tool to the global or local .tool-versions before it can used asdf local <name> <version> or asdf global <name> <version>. Installing the language/tool to locally means it can be used in the current directory or any subdirectories. Installing to global means that it can be used anywhere on the system. Tools that are not loaded cannot be used.

Additionally, asdf supports using a .tool-versions file to install multiple tools. Running asdf install in a directory with a .tool-versions will install the tools listed in the file. The installed tools are only be available in that directory or any subdirectories.

Codify Resources

The Codify asdf resources are designed to replicate the same design model as the original tool.

  • asdf: Installs asdf itself and optionally this resource can install plugins (as an added feature to help improve usability)
  • asdf-plugin: Installs an asdf plugin and optionally and install specific versions of the tool using the plugin (added feature).
  • asdf-local: Loads the asdf tool version locally to a directory or multiple directories.
  • asdf-global: Loads the asdf tool version globally.
  • asdf-install: Installs the .tool-versions file in a directory or installs a version of a tool. asdf-install will add missing plugins automatically (added feature)

Parameters:

Example usage:

Install asdf:

codify.json
[
{
"type": "asdf"
}
]

Install asdf and the nodejs and golang plugins:

codify.json
[
{
"type": "asdf",
"plugins": ["nodejs", "golang"]
}
]

A full config for installing a .tool-versions file

The asdf-install resource will automatically install missing plugins if they exist in a .tool-versions file. This is additional functionality added by Codify. The config below installs asdf, installs the necessary plugins and then installs the tool versions specified in ~/path/to/dir/.tool-versions.

codify.json
[
{
"type": "asdf"
},
{
"type": "asdf-install",
"directory": "~/path/to/dir"
}
]

Installing nodejs globally

Asdf provides the latest keyword shortcut. Other-wise fully qualified version (down to the patch level) must be used. This config will install asdf, the nodejs plugin, install node versions latest and 20.18.0, and then load 20.18.0 as the globally available version.

codify.json
[
{
"type": "asdf"
},
{
"type": "asdf-plugin",
"plugin": "nodejs",
"versions": ["latest", "20.18.0"]
},
{
"type": "asdf-global",
"plugin": "nodejs",
"version": "20.18.0"
}
]