Blog

Managing Multiple Versions of Runtime For Local Development

Allan Andal portrait
Allan Andal
December 17, 2023

As a new web programmer (or maybe as a seasoned one), and as you google your way on learning new technologies, chances are you will be following the official how-to instructions provided by the specific programming language or whatever tools you may want to install on your computer. In case of ruby, you might end up following this guide Installing Ruby. That would be a logical approach, however probably a naïve one.

The truth of the matter is, in terms of web development, you’ll be needing way more than one version of ruby installed on your computer. You may have to use rvm, rbenv and other ruby versions manager to solve this, but what about nodejs for JavaScript or some python which would probably be needed as you build some dependencies. Maybe you want to learn some mobile development using flutter or other new stuff that piques your interest. You would be lucky if you don’t stumble to any issue of installation conflicts or dependency resolutions issues. By installing this way, overtime, you will realize the clutter you have made on your computer, and you probably want to start fresh again!

To save yourself some trouble, it would be wise to use all-in-one versions manager whenever it is possible, here we can use asdf. It’s a tool to manage each of your project runtimes with a single CLI tool and command interface.

For instance, my user config file looks like below, this shows all the runtimes that works on my computer, some are for work projects, and some are personal learning agenda, whatever language or tool I might fancy playing around with.


# ~/.tool-versions
java openjdk-17
python 3.11.1
python 2.7.18
flutter 3.3.10-stable
elixir 1.12.3-otp-24
erlang 24.3.4.6
ruby 2.7.8
ruby 3.2.2
yarn 1.22.10
nodejs 12.22.12
nodejs 20.5.0
php 7.4

Meanwhile a project specific config might look like


# ~/projects/awesome_project/.tool-versions
ruby 3.1.2
nodejs 18.15.0
yarn 1.22.19

Similar to other language specific versions manager (rvm, rbenv, nvm, pyenv, phpenv etc), asdf switches to correct runtime versions as you switch to your project folder. Installing missing runtime version is as simple as running asdf install.

If you are working on a existing project that uses other version manager, you can add .asdfrc file on your project folder.


legacy_version_file = yes

This will detect any legacy version file (eg; .ruby-version) on your folder and use it as fallback when not listed on project’s .tool-versions config file. However, it would be ideal if the project will be migrated to using this tool (which shouldn’t be too hard) so that teams uses the exact same versions of tools with support for many tools via a plugin system, and the simplicity and familiarity of being a single Shell script you include in your Shell config.

In conclusion, asdf serves as a valuable tool in your web development arsenal, easing the burden of managing multiple runtime versions and allowing you to focus on what truly matters – building remarkable projects and advancing your skills in the dynamic world of web programming. So, take a leap forward, embrace asdf, and unlock the true potential of your local development environment.

Thanks for reading, no matter your software problem, we provide a complete solution to scope, design, develop, test, host, maintain and support it 24/7/365. Contact us to find out how can we bring your ideas to reality!