Skip to content

Using RVM in shell scripts

Finn Bacall edited this page Jul 11, 2018 · 1 revision

Create an alias to the required ruby version and gemset:

rvm alias create tess ruby-2.2.6@tess

(This creates an alias called "tess", pointing to a gemset named "tess" under ruby version 2.2.6)

Check where your RVM is located:

echo $rvm_path

Add the following to the beginning of your shell scripts:

<path from the above command>/environments/tess

(Where "tess" is the alias we created in step 1.)

If the ruby version or gemset name is changed, simply re-run the alias command, referencing the new version:

rvm alias create tess ruby-3.0.0@new-tess

...and all shell scripts should still work!