0

I have a RedHat 7 system and I have installed the ruby 2.0.0.648 and rubygem 2.0.14 package and it has also installed a few dependent gems.

My problem is when I run the gem list command I don't see any of the gems.

If I cd into the /usr/share/gems/gems/ directory I can see all of the files.

My question is…

How can I force the “gems command” to scan the /usr/share/gems/gems directory and update the *** LOCAL GEMS *** database?

There has to be a way to manually edit the files to tell the gems command that all of the files are really on the system.

Phil Ross
  • 25,590
  • 9
  • 67
  • 77
CooLC
  • 1
  • 1
    Install RVM with `\curl -sSL https://get.rvm.io | bash -s stable`; install Ruby with `rvm install 2.0.0`. [Don't](https://robots.thoughtbot.com/psa-do-not-use-system-ruby) [use](https://chrisherring.co/posts/why-you-shouldn-t-use-the-system-ruby) [system Ruby](http://billpatrianakos.me/blog/2014/05/15/never-use-system-ruby-ever/). (and if possible, please use a newer version of Ruby as support for 2.0 [ended three years ago](https://www.ruby-lang.org/en/news/2016/02/24/support-plan-of-ruby-2-0-0-and-2-1/)) – anothermh Jan 02 '19 at 18:02
  • This system cannot be added to the internet. (it totally closed off) I'm not an rvm expert but I think that tool works by automatically downloading gems from the network, right? If so then that tool would not work since I dont have any internet access, ls -tr /usr/share/gems/gems/ shows all of the gems. Is there a way to make them appear in the *** LOCAL GEMS *** databse? – CooLC Jan 02 '19 at 18:05

1 Answers1

0

You can change the path to your gems by running the following command in your shell (or by adding it to your shell profile and reloading your shell):

export GEM_PATH=/usr/share/gems/gems

After running this command you can verify that the change has taken effect by running gem env:

RubyGems Environment:
  <snipped>
  - GEM PATHS:
     - /usr/share/gems/gems
  <snipped>

It sounds like you are not installing additional gems since your system is not connected to the Internet, but if you were to use the gem install command then you would also want to set GEM_HOME to the same path:

export GEM_HOME=/usr/share/gems/gems

GEM_PATH is where gem and bundler will find gems and GEM_HOME is where gems will be installed.

More details here and here.

anothermh
  • 9,815
  • 3
  • 33
  • 52