Many of us have used rvm or rbenv to manage Ruby, nvm or n to manage our Node installs, pyenv for Python. The problem is when you need to add other things into the mix like gvm for Go, the list goes on.
ASDF to the rescue!
Manage multiple runtime versions with a single CLI tool
ASDF allows you to manage many environments on a per project basis. ASDF has done for my project management what homebrew did for my Mac.
Let's say for example you had RVM and NVM installed and Dart was done via shell scripts. Sure, you're already on top of it - but why accept the pain involved with managing them on top of the environments themselves?
You may not suffer from any of the above and just have one environment to handle, but nonetheless, make it easy for someone who has to manage or maintain your work after you're done with it.
If you're working on or maintaining multiple projects with a team of people, asdf will make all of your lives much easier.
I'll demonstrate how easy it is to take control and get some of your sanity back.
We'll work with Node for this example.
brew install asdf
If you are on Linux or are using Linux subsystem on Windows or don't use homebrew on macOS, you can install via git.
These are for anyone who installed via homebrew. If you installed via git, follow the instructions on the asdf website.
echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ~/.bash_profile echo -e "\n. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash" >> ~/.bash_profile
You might not have all the dependencies installed, so you need to run:
brew install \ coreutils automake autoconf openssl \ libyaml readline libxslt libtool unixodbc \ unzip curl
ASDF comes with extensive language support via it's plugin system
asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
For nodejs we will also have to add the release team's OpenPGP keys to main keyring:
asdf list-all nodejs
This will output all the versions you can install via asdf.
asdf install nodejs 13.3.0
Let's set a system wide version, which will be the default version.
asdf global nodejs 13.3.0
asdf install nodejs 7.9.0
asdf local nodejs 7.9.0
You can store your settings for the project by creating a
inside your current project add the following setting:
If you commit this to your project and someone else picks it up, asdf will understand what version to use and prompt you to install it if necessary.
Now you have one manager to manage your multiple development environments. You only need to keep asdf up to date, which is easy peasy.
brew upgrade asdf
or via git
You can rinse and repeat this for as many environments as you need, in as many projects as necessary.
How easy is that!