RVM: How to use gems from a different ruby?

痞子三分冷 提交于 2019-12-03 10:20:11

问题


I have been using RVM to manage my Rubies and gems.

When I first installed RVM, the Ruby version that I installed was 1.9.2-p0. I recently installed Ruby 1.9.2-p136, which created a new Ruby in the RVM.

My problem is I want to use the latest version of Ruby but all of the gems I installed were installed under the 1.9.2-p0 directory, because RVM keeps gems completely separate between Rubies, and I want to be able to use those gems with my new version, p-136 without having to reinstall them all.

Is there a way I can get my gems from my p-0 Ruby to work with my p-136 Ruby?


回答1:


You need to check out gemsets and export your current gems.

rvm gemset export

Read the gemset docs for more information.




回答2:


You can use copy in rvm

$ rvm gemset copy 1.9.2-p0 1.9.2-p136

See more about the rvm copy command

This is the fastest way to get your gems moved over and it wont reinstall everything, just copy them over. But once you've got that squared away I'd do as the others are suggesting and start using gemsets. It's a nice way to group the gems you use in your projects.




回答3:


This might help: http://rvm.io/gemsets/initial/

Basically, if you setup a global gemset configuration, those gems will be used for every ruby version you install.




回答4:


You can copy a gemset from one ruby to another. rvm copy

$ rvm gemset copy 2.1.1@rails4 2.1.2@rails4


来源:https://stackoverflow.com/questions/4982786/rvm-how-to-use-gems-from-a-different-ruby

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!