Manage multiple Crystal Lang versions

As Crystal 0.36 is now out on Crystal Lang you may want to manage multiple versions of the crystal compiler locally. Let's see how to do that quickly and easily.

Asdf to the rescue

Whatever the language you are using, I highly recommend using Asdf-vm to manage your multiple versions. It works with almost all the languages you can think of.

Follow the instructions to install asdf on their website and once it's done, install the versions of crystal you want to have locally, so for example, 0.35.1 and 0.36.1:

asdf install crystal latest:0.35
asdf install crystal latest:0.36

You can then type asdf list crystal and you should see something like that:

➜  ~ asdf list crystal

Set current crystal version

You can then set your crystal version:

So for example, my setup is this one actually : 0.36.1 globally, and 0.35.1 for my lucky projects because Lucky is not compatible with 0.36 for now.