0

What I did:

I installed rails by mistake to the wrong gemset.

$ rvm use 1.9.3
Using /home/username/.rvm/gems/ruby-1.9.3-p125
$ gem env gemdir
/home/username/.rvm/gems/ruby-1.9.3-p125
$ gem install rails

It should have gone into the global gemset.

$ rvm use 1.9.3
Using /home/username/.rvm/gems/ruby-1.9.3-p125
$ rvm gemset use global
Using ruby-1.9.3-p125 with gemset global
$ gem env gemdir
/home/username/.rvm/gems/ruby-1.9.3-p125@global
$ gem install rails

Questions:

  1. How can I uninstall the whole list of gems installed with rails as well as rdoc and ri without affecting other gems installed in the same gemset? Can I also clean the cache/ folder in the same step?
  2. As far as I understood it is best practice to install common gems into the global gemset, while project specific gems will go into the specific gemset of that project. Is that correct?
  3. By the way, what is the "wrong" gemset under /home/username/.rvm/gems/ruby-1.9.3-p125 good for anyways?

I am aware of similar questions like these.

Though, I do not want to reinstall or update rails. I simply want to remove it from that particular gemset.


Approximation / question 1:

I only found an answer to the first question. Thus, it does not remove rails and its dependencies but all gems. This is what I did following the example given. I left off the name since there is no specific name, as far as I understand.

rvm use 1.9.3
Using /home/username/.rvm/gems/ruby-1.9.3-p125
rvm gemset empty

This removed the files under doc/ and gems/. However, the cache/ folder is still filled.

Community
  • 1
  • 1
JJD
  • 50,076
  • 60
  • 203
  • 339

1 Answers1

1
  1. How can I uninstall the whole list of gems as well as rdoc and ri?

gem uninstall gemname1 gemname2 ...

will also remove ri and rdoc, just list the gem's names without any commas. (you can list all be using "gem list")

UPDATE: "rvm gemset empty" works faster indeed.

  1. As far as I understood it is best practice to install common gems into the global gemset, while project specific gems will go into the specific gemset of that project. Is that correct?

Yes, it's correct. Global gemset is reached by all Gemsets from the same Ruby version.

  1. By the way, what is the "wrong" gemset under /home/username/.rvm/gems/ruby-1.9.3-p125 good for anyways?

I think it's global. Try "gemset list" to which one is that. There will be a = sign before the current one in use and a > sign before default gemset.

I think maybe your gemset is not wrong, it's probably how you want it. Try to make a new Gemset, and change to it and list all gems, probably you're gonna see all your gems.

You can remove a whole gemset anytime (except global) by:

gemset delete gemsetname

Also you might want to install rails without ri and rdoc:

gem install rails --no-ri --no-rdoc

YogiZoli
  • 870
  • 1
  • 9
  • 17
  • All `rvm gemset list` prompts to me are the gemsets `global` and `=> my_project` (when I am in the project folder). But in `~/.rvm/` I can find three folders which are `ruby-1.9.3-p125`, `ruby-1.9.3-p125@global`, `ruby-1.9.3-p125@my_project`. – JJD Apr 20 '12 at 00:21
  • Okay, I think I'd remove all gems (by rvm gemset empty) without using any Gemset, then install Rails to global, then start the project in my_project. – YogiZoli Apr 20 '12 at 00:36
  • I checked it on my local, for me those folders which doesn't ended with @gemsetname so like ruby-1.9.3-p125 are all empty. On your local? – YogiZoli Apr 20 '12 at 00:36
  • As I already indicated in my question update: the `cache/` folder is [still filled](http://pastebin.com/0v4GEc5n) after I run `rvm gemset empty`. However, the command is not satisfying since **I want to be able to uninstall a particular gem without affecting the other gems** in the same set. – JJD Apr 20 '12 at 08:59