Removing Gems errors

早过忘川 提交于 2019-12-01 14:32:48

USING RVM

1) Install rvm.

In the rest of the steps:

DON'T EVER USE SUDO

2) Install ruby (pick a version):

$ rvm install 1.9.3

3) Make sure rvm's current ruby is the version you want to use for your app :

$ rvm list

and if necessary:

$ rvm use 1.9.3-p194  #Sometimes you have to specify the patch number as well, e.g p194

4) Create a gemset for your app:

$ rvm gemset create myapp_gemset

5) You can list the gemsets for the current ruby version:

$ rvm gemset list

and if necessary switch to the gemset you just created:

$ rvm gemset use myapp_gemset

6) Install the rails gem:

$ gem install rails --version 4.0.0

That command will install the gem into the current gemset. You can check the version:

$ rails -v

There is a shortcut you can use to select the ruby version and a gemset you previously created for that ruby version:

$ rvm use 1.9.3-p194@myapp_gemset

You can also set a default ruby and gemset that will be selected when you open a new terminal window:

$ rvm use 1.9.3-p194@myapp_gemset --default

Or, you can set up your Gemfile in your app so that rvm switches to the specified ruby version and gemset when you change directories into your app's directory:

Gemfile:

ruby '1.9.3'   #(no patch number allowed here)
#ruby-gemset=myapp_gemset

rvm will read that comment in your Gemfile, and then switch to the ruby version on the previous line and the gemset specified in the comment.

. .

https://rvm.io/gemsets/deleting

Deleting Gemsets

When you delete a gemset, rvm will prompt you to confirm the deletion.

$ rvm gemset use albinochipmunk
$ rvm gemset delete albinochipmunk

To skip confirmation, pass the --force flag:

$ rvm gemset use albinochipmunk
$ rvm --force gemset delete albinochipmunk

By default, rvm deletes gemsets from the currently selected Ruby interpreter. To delete a gemset from a different interpreter, say 1.9.2, run your command this way:

$ rvm 1.9.2 do gemset delete albinochipmunk

.

If you don't use a gemset at all, you get the gems in the 'default' set

.

https://rvm.io/gemsets/emptying

Emptying Gemsets

If you empty a gemset, rvm will prompt you for confirmation. This action removes all gems installed in the gemset.

$ rvm gemset use albinochipmunk 
$ rvm gemset empty albinochipmunk 

To skip confirmation, pass the --force flag:

$ rvm gemset use albinochipmunk 
$ rvm --force gemset empty albinochipmunk

RVM installs some gems in the global gemset you can uninstall those gems with:

rvm @global do gem uninstall gem_name

if you do not want to use any gemsets (except the single per ruby gemset) use: this:

echo rvm_ignore_gemsets_flag=1 >> ~/.rvmrc

and from now on RVM will use only single gemset - no global

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