DEV Community

Cover image for The Evolution of Ruby Version Management
Salajan Silviu
Salajan Silviu

Posted on

3 1 1

The Evolution of Ruby Version Management

Managing Ruby versions has been a cornerstone of any developer's toolkit since the early days of Ruby's popularity. Over the years, several Ruby version managers have emerged, each with its unique strengths and weaknesses. This article explores this evolution, focusing on why Mise has become my preferred choice.

The Beginnings with RVM

For many Ruby developers, myself included, RVM (Ruby Version Manager) was the first introduction to managing multiple Ruby versions on the same machine. RVM's comprehensive feature set and ease of use made it incredibly popular. It allowed developers to switch between Ruby versions seamlessly, isolate project environments with gemsets, and manage dependencies effortlessly.

As a hardline lover of RVM, I appreciated its all-in-one nature. It was reliable, well-documented, and had a large community behind it. However, RVM’s all-encompassing approach also meant that it was relatively heavy and could sometimes interfere with system-level settings, leading to potential conflicts and a steeper learning curve for newcomers.

Exploring Alternatives: rbenv

Over time, I became curious about rbenv, which offered a more lightweight approach to Ruby version management. Unlike RVM, rbenv doesn’t overwrite shell commands or try to manage everything about your Ruby environment. Instead, it uses shims to provide different Ruby versions per project.

While rbenv’s simplicity was appealing, I often found it lacking some of the conveniences RVM provided out of the box, such as gemsets. This led to additional setup for managing gems across different projects, which slightly diminished the initial attraction of rbenv's minimalist philosophy.

The Versatility of asdf

The introduction of asdf changed the game by offering a version manager not just for Ruby but for multiple languages and tools, including Node.js, Python, Elixir, and more. For developers working in polyglot environments, asdf was a revelation. It consolidated all version management under a single tool, reducing the overhead of learning and maintaining different managers for different languages.

Asdf’s plugin-based architecture was powerful, allowing the community to contribute and expand its capabilities. However, asdf’s flexibility also introduced complexity. The plugin system, while expansive, could sometimes lead to inconsistencies or issues when plugins were not maintained to the same standard.

Why I Switched to Mise (RTX)

Now, I find myself using Mise, a tool that has impressed me with its balance of flexibility and simplicity. Like asdf, Mise supports multiple languages and tools, making it a versatile choice for developers who work across different environments. However, Mise goes a step further by streamlining the user experience, providing better performance, and integrating more tightly with the system.

Mise is built on the shoulders of asdf, taking the best parts of it and refining the experience. It offers easier configuration, faster command execution, and a more polished interface. Additionally, it has a growing community and active development, which means it's continuously improving.

One of the standout features of Mise is its approach to plugins and language support. While asdf’s plugin system is powerful, Mise offers better consistency and reliability by maintaining a core set of well-supported plugins. This reduces the risk of running into issues and provides a smoother, more predictable experience.

The Future with Mise

After years of using RVM, rbenv, and asdf, I’ve settled on Mise as my version manager of choice. It combines the best elements of its predecessors—RVM’s comprehensiveness, rbenv’s simplicity, and asdf’s versatility—while improving on their weaknesses. Mise offers a modern, efficient solution that’s well-suited for the demands of today’s developers, particularly those working in multi-language environments.

While each of these tools has its place and merits, I believe Mise represents the future of version management, especially for those who value performance, ease of use, and a unified toolset for multiple languages. If you haven’t tried it yet, I highly recommend giving Mise a spin—you might find yourself making the switch just as I did.

Top comments (4)

Collapse
 
salex profile image
Steve Alex

I've spent a couple days trying to understand how to use mise with Ruby and RoR. I have to admit I'm lost!

This was on a bare bones new Ubuntu server. I finally got ruby 3.2 installed after many tries at this and that. I could get mise use --global ruby to create a new ruby version. I could get mise use -- ruby -v got print the version. But nowhere can I find on how to use it with Rails.

Can't use it to install the Rails gem or do anything but display the version number!

I know I'm missing a lot but until there is some use documentation, I'll stick with rbenv. I'm in no hurry. old stuff works!

Collapse
 
salanoid profile image
Salajan Silviu

I tried Mise because DHH uses it, and it's nice since you can install multiple languages with it. In omakub, you can find a script on how to use it, but for me, the official documentation was good enough. Mise is still a relatively new version manager, and its documentation can be sparse.

1. Ensure Mise is Activating the Correct Ruby

Run:

mise exec -- ruby -v
Enter fullscreen mode Exit fullscreen mode

This ensures that Ruby is being executed through Mise. If the version doesn’t match what you expect, try:

mise reshim
Enter fullscreen mode Exit fullscreen mode

This regenerates the shims to properly point to the installed binaries.

2. Install Bundler and Rails with Mise's Ruby

Since Mise manages versions but not gems directly, you need to install Bundler and Rails inside the version of Ruby that Mise is using:

mise exec -- gem install bundler
mise exec -- gem install rails
mise reshim # Important after installing gems with binaries
Enter fullscreen mode Exit fullscreen mode

3. Check if Rails is Available

Try running:

mise exec -- rails -v
Enter fullscreen mode Exit fullscreen mode

If that works, then your Rails installation is functioning properly.

4. Global vs Local Environment Setup

Global Installation

If you want Rails available globally, install it in the global Ruby environment:

mise use --global ruby@3.2
mise exec -- gem install rails
mise reshim
Enter fullscreen mode Exit fullscreen mode

Per-Project Setup

If you prefer a per-project setup, use a .tool-versions file in your project directory:

echo "ruby 3.2" > .tool-versions
mise install
mise exec -- gem install rails
mise reshim
Enter fullscreen mode Exit fullscreen mode

5. Ensure Shell is Set Up Correctly

If you’re having trouble, check your shell configuration to ensure Mise is initialized properly. Add this to ~/.bashrc or ~/.zshrc:

eval "$(mise activate)"
Enter fullscreen mode Exit fullscreen mode

Then restart your terminal or run:

source ~/.bashrc # or source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

If these steps still don’t work, I totally get sticking with rbenv if it works for you—Mise is still growing.

Collapse
 
salex profile image
Steve Alex

I finally found a good article on how to use mise with rails. Damn if I can find it!

It came down to putting

eval "$(~/.local/bin/mise activate)"

in my .bashrc file. About the same as you suggested.

Thread Thread
 
salanoid profile image
Salajan Silviu

Nice, good job! 😄 ㊗️

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay