Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a Gem Path?

Tags:

ruby

rubygems

rvm

When I run gem environment I get a list which includes the following:

  • GEM PATHS:
    • /home/rescue/.rvm/rubies/ruby-2.3.3/lib/ruby/gems/2.3.0
    • /home/rescue/.gem/ruby/2.3.0

I'd like to add a path. I see people suggesting to add something like export GEM_PATH = ... to my .bashrc file, but I fear this would replace the existing gem paths.

How can I add another path in addition to the ones that already exist?

like image 738
Philip Kirkbride Avatar asked May 31 '17 20:05

Philip Kirkbride


People also ask

Where do installed gems go?

When you use the --user-install option, RubyGems will install the gems to a directory inside your home directory, something like ~/. gem/ruby/1.9.

How do I install a new gem?

To install a gem, use gem install [gem] . Browsing installed gems is done with gem list . For more information about the gem command, see below or head to RubyGems' docs. There are other sources of libraries though.

How do I run Gemfile?

run the command bundle install in your shell, once you have your Gemfile created. This command will look your Gemfile and install the relevant Gems on the indicated versions. The Gemfiles are installed because in your Gemfile you are pointing out the source where the gems can be downloaded from.


1 Answers

When you run echo $GEM_PATH you'll probably see 2 paths separated with colon. It's standard in setting multiple paths in env variables.

If you want to add more directories then you can add 1 more path without removing old ones with EXPORT GEM_PATH=$GEM_PATH:/your/new/path

like image 136
Bartosz Bonisławski Avatar answered Oct 07 '22 05:10

Bartosz Bonisławski