How to use RVM - Ruby Version Manager

Install a ruby version

rvm install 3.2.0

Create a gemset for a specific project (or environment)

rvm 3.2.0@project-name --create

Use gemset:

rvm use 3.2.0@project-name

Use the gemset whenever you CD into the folder

  1. Add the following to your $HOME/.rvmrc:

    export rvm_project_rvmrc=1
    
  2. Create the files in your project root directory: .ruby-version and .ruby-gemset.

    Run:

    rvm --ruby-version use 3.2.0@project-name
    

    Gemsets are not supported by other tools, that’s why rvm recommends to use separate file (.ruby-gemset).

  3. Create Gemfile:

    gem install bundler
    bundler init
    

Get the GEM_HOME environment variable

This variable points to the place where gems will be installed.

rvm gemdir

Get the GET_PATH environment variable

This variable points to the places where Ruby will look for gems.

echo $GEM_PATH
rvm rvmrc to ruby-version

Docs

  • Typical RVM project workflow: https://rvm.io/workflow/projects