RVM or RbENV

1 > 2 = true

·

2 min read

Hello all!

Ruby has many versions 2.x.x / 3.x.x and its not necessary that all applications/projects runs on all ruby versions.

Every Rails app has a set of gems as you can see in the 'Gemfile' and is critical to build & run your rails framework and application.

Since its costly and plain useless and sort of impossible to create one common system environment of Ruby for all your applications, Ruby Version Managers help us create and maintain separate localised environments for each and every one of your projects.

Two most used such tools are RVM and RbEnv. Both are equally good and highly useful.

You can choose either one of them and doesn't affect anything regarding your Ruby/Rails applications.

I've used both of them personally and both are similar except for a some changes in the syntax and usage.

I do face some issues in using .rvm in my MacOS but thats just me. Both work fine on my Linux machine. Make sure to use only one of them in your app. Using both can possibly corrupt your work environment and your application.

Hence the clever title: 1 > 2 = true. Not that I am very bad at Mathematricx.

How do you create a ruby environment for your app and gemset.

EZ!

Simply add a file named ".ruby-version" to your app and add the line:

# my_app_directory/.ruby-version

ruby-2.6.6      # for example
# You can also name it something like ruby-2.6.6@my_app_name

Whenever you switch to your app directory, your ruby version manager reads this file and loads the environment mentioned in it and the app's gemsets as well.

You can find the usage, installation, working and more in their documentation here:

  1. RVM

  2. RbEnv

Thats it for today!

Thank you all for tuning in!

Keep reading, show support and spread love.

Love,

M.

liked_the_post == true ? comment and share : comment and share