How to switch to an older version of Ruby in Mac OS

Bryant Jimin Son
3 min readOct 13, 2021
This blog will show you how to switch to an older version of Ruby in Mac OS

As a developer, you often need to run an application, a tool, or scripts built by an open source community group or your team that only supports a particular programming runtime version. Theoretically, if you are a programming genius, you can figure out how to fix all the dependencies issues and gotchas to upgrade that tool to support all different types of programming runtime versions. However, this is quite an arduous task, so you may find it easier to quickly switch to an older version.

This was exactly a problem that I encountered while looking to install an internal tool built by some developers in my company. The tool is built in Ruby programming language, and Gemfile defines that ruby has to be the version between 2.4.0 to 2.6.x. So, when I ran a script to install the tool, the installation failed because I had a version of Ruby that is 3.x. That particular dependency that led to the failure was the latest and no longer in development, so I could not easily fix the problem by upgrading the version defined in a file with .gemspec extension.

However, I had two Ruby versions installed in my Mac, which I could find out running the following command:

$ which -a ruby

My two Ruby installations were at the following two paths:

/usr/local/opt/ruby/bin/ruby

--

--

Bryant Jimin Son
Bryant Jimin Son

Written by Bryant Jimin Son

A cloud practitioner talking about technology, travels & career tips. But I will sometimes cover financial advises and some random stuffs.

No responses yet