bvkgtw
Last Updated: August 23, 2016
·
5.928K
· rbmrclo
2fe1468f365b2c131b38e87aa4acb601

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

Say Thanks
Respond

1 Response
Add your response

7688
Eb6efcfe904f75154b9e3d74798e6d72

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 ·