April 25, 2022
In the past I have used nvm, pyenv, and rvm for managing multiple installs of programming language runtimes for NodeJS, Python, and Ruby respectively. I recently did a clean format and this time around am going to try asdf which takes a stab at being a single tool for this purpose.
The asdf installation instructions on macOS assume Homebrew is used to install some dependencies. I generally favour using Nix instead, so the instructions below are how I got it to work instead.
Before executing any of the command line statements below it would be best to check each source first to make sure they are current as they could and most likely will change over time.
$ sh <(curl -L https://nixos.org/nix/install)
There are multiple installation options offered for asdf, the one I picked was ZSH & Git:
$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.0
And then I added the following to the ~/.zshrc
file:
# 2022-04-25: asdf-vm.com, manages installs such as Node
. $HOME/.asdf/asdf.sh
$ nix-env -i gpgme gawk
$ asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
$ asdf install nodejs 16.14.2
$ asdf global nodejs 16.14.2
$ node --version
v16.14.2