Back

asdf: another package manager

the ultimate version manager for programming languages

Let’s start with a simple question “how would you manage multiple version of Node.js on a single machine”, you may come across with various options, either is great
<columns>
<column>
<unknown url="https://app.notion.com/p/e5bc7ab479974481b902ec1eb170e3bd#9fd88e9942b04dedb0bacf6cd76574ea" alt="external_object_instance"/>
</column>
<column>
<unknown url="https://app.notion.com/p/e5bc7ab479974481b902ec1eb170e3bd#1e6c1556fc014ab1b777005431b58ed0" alt="external_object_instance"/>
</column>
</columns>
Not long after, the latest stable version of Node.js is released, along with all the promised improvements, you’ll have projects to upgrade
<columns>
<column>
In n,
</column>
<column>
In nvm,
</column>
</columns>
<columns>
<column>
```shell
n lts
n
```
</column>
<column>
```shell
nvm install --lts
nvm use --lts
```
</column>
</columns>
Equally simple.

However, every once in a while, you’ll need to switch another project written in Ruby, potentially the backend of your Node.js project, then you’ll need to ask the very same question in the beginning of article for Ruby. This time you may come across with
<columns>
<column>
<unknown url="https://app.notion.com/p/e5bc7ab479974481b902ec1eb170e3bd#34511f243b254c0586fcfa0b57b4ca32" alt="external_object_instance"/>
</column>
<column>
<unknown url="https://app.notion.com/p/e5bc7ab479974481b902ec1eb170e3bd#eb3814a4f7e240f59c02adda4ea57e5f" alt="external_object_instance"/>
</column>
</columns>
How about using the latest stable version of Ruby then?
<columns>
<column>
In rbenv,
</column>
<column>
In rvm,
</column>
</columns>
<columns>
<column>
```shell
rbenv install 3.0.2
rbenv use 3.0.2
```
</column>
<column>
```shell
rvm install --lts
rvm use --lts
```
</column>
</columns>
Here we start to see some issue. Not a surprise, the CLI (command line interface) for the Node and Ruby version managers are different, and discrepancies are hard to remember due to context switching.

Fallback to Google? Well, don’t repeat yourself.
But the CLI of nvm and rvm looks similar to each other? Yes, until you need to work with a data science tool written in Python and look for something like pvm while everyone else uses pyenv.

It’s clear that what we really want is a single CLI tool that manages different versions of different runtime (programming language) with a unified interface, and asdf exists exact for this reason.
<columns>
<column>
<unknown url="https://app.notion.com/p/e5bc7ab479974481b902ec1eb170e3bd#2afd6c1eca9c4ef1b9ea2829f195545c" alt="external_object_instance"/>
<unknown url="https://app.notion.com/p/e5bc7ab479974481b902ec1eb170e3bd#98828c8c4a4b457aa52a31a9a8d5e40e" alt="bookmark"/>
</column>
<column>
```shell
asdf install <name> <version>
asdf local <name> <version>
```
</column>
</columns>

Give it a try! :D

Comments