DEV Community

Cover image for asdf (what?? πŸ€”)
Mainendra
Mainendra

Posted on

asdf (what?? πŸ€”)

asdf - the multiple runtime version manager

Why asdf?

  • Simple to install and maintain.
  • Easy to switch runtime (e.g. nodejs) version, just cd into directory
  • one tool for most common runtime needed for development

Installation

brew install asdf
Enter fullscreen mode Exit fullscreen mode

for details refer to - getting started

Update path (for zsh shell)

echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc
Enter fullscreen mode Exit fullscreen mode

for other shells refer to - getting started

Install plugin (nodejs)

asdf plugin add nodejs
Enter fullscreen mode Exit fullscreen mode

other supported plugins

Install node latest version

asdf install nodejs latest
Enter fullscreen mode Exit fullscreen mode

user version number instead of latest for any specific version

e.g. asdf install nodejs 20.12.0

To use any globally everywhere

asdf global nodejs latest
Enter fullscreen mode Exit fullscreen mode

To use any folder specific local version

cd local_folder
asdf local nodejs 20.12.0
Enter fullscreen mode Exit fullscreen mode

config file

  • Global version versions config normally available under home folder (~/.tool-versions)
  • Local version will be under specific local folder same file name .tool-versions

config file format

deno 1.44.4
nodejs 20.12.2
rust 1.79.0
yarn 1.22.22
pnpm 9.4.0
Enter fullscreen mode Exit fullscreen mode

for another other details refer to documentation on asdf-vm.com

Note

Don't forget to run asdf reshim after installing global packages (e.g. npm install -g <tool_name>, cargo install <tool_name>, etc)

HAPPY CODING πŸŽ‰

Top comments (0)