Last Updated: January 28, 2019
·
16.74K
· rbmrclo

Easy way to create gemset per project using RVM

Assuming that you are already on your project directory.
Now run these commands from your CLI.

Step 1: rvm gemset create [name of gemset]
Step 2: rvm --rvmrc [ruby version here]@[name of gemset]
# Note: You can check your current ruby version by running "ruby -v" from your console.
Step 3: Refresh your directory. 
# You can simply do this by checking out of your directory and going back to that directory again.
Step 4: RVM will ask you a simple Yes, No, View, Cancel question. Press Y for yes.
Step 5: You're done! Run bundle install.

Live example:

Current directory: Projects/DumbProject |
Current ruby version: ruby-1.9.3-p327

$ rvm gemset create dumb
gemset created dumb   => /Users/awesomeness/.rvm/gems/ruby-1.9.3-p327@dumb
$ rvm --rvmrc ruby-1.9.3-p327@dumb
$ cd..
$ cd DumbProject
* Do you wish to trust '/Users/awesomeness/Projects/DumbProject/.rvmrc'?
* Choose v[iew] below to view the contents
y[es], n[o], v[iew], c[ancel]> y
$ y
$ bundle install

Note: In this case, i always put .rvmrc file in my global .gitignore file so I don't need to bother every project I fork with pull requests. You can look at this reference on how to set up your global gitignore: https://help.github.com/articles/ignoring-files

1 Response
Add your response

Stable and Head version of RVM now uses .ruby-version and .ruby-gemset:

$ cd project
$ rvm use ruby-2.0.0@project --ruby-version --create

Really handy, also bypasses the trust issue.

over 1 year ago ·