asdf: a great way to manage all developers CLI tools

Do you ever code in modern Javascript? Then if you have multiple projects you are probably happy that nvm exists. Or maybe you’re more of a Python person? Then you must know about pyenv. Java? jenv or sdkman!

Thing is, you often need to have multiple versions of a tool or binary installed when you are working on different projects, that’s when version managers become useful. Because you don’t need to remember the different locations where your binaries are installed and you don’t need to guess if your python command is Python 2 or 3. But with so many version managers, I am starting to forget which one I have installed and even their names!

Recently I’ve discovered asdf, which I’m currently giving a try. It is a plugin-based version manager that can work for a lot of CLI tools.

When installed, handling different versions for your favorite tools becomes a breeze:

asdf plugin add python # install python plugin
asdf install python latest # install last python release
asdf install python 2.7.18 # install python 2
asdf global python latest # set latest as the global version to use on the system

python --version # shows python latest version
asdf shell python 2.7.18 # change python version only for current shell session
python --version # shows python 2.7.18

The same commands can be used to manage version of other tools (node, java…). Likewise, the command asdf local will override the global version and set a version for the current directory, which is useful for working on multiple codebases! You can find all the plugins made for asdf in this GitHub repository.

In conclusion, Even though some dedicated version managers might offer some specific features related to their tool asdf looks like a great default way of handling my CLI tools from now on.

— Morgan Ridel