Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I'm using rbenv, so why are there two Gem paths on my system? (OS X Lion)

To clarify, I'm using rbenv to manage my ruby versions. I was under the impression that binaries are managed as shims in their respective ruby version directory.

Here is what my system shows when I run gem environment (I'm excluding the irrelevant parts):

 - GEM PATHS:
     - /Volumes/Data/nathan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1
     - /Volumes/Data/nathan/.gem/ruby/1.9.1

Any reason for having two locations? Curious minds want to know.

like image 634
Nathan Avatar asked May 03 '12 13:05

Nathan


People also ask

Where are gems stored Mac?

By default, binaries installed by gem will be placed into: /usr/local/lib/ruby/gems/3.1.

Where are RubyGems stored?

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. 1 . The commands provided by the gems you installed will end up in ~/.

What is RubyGems Mac?

RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries (in a self-contained format called a "gem"), a tool designed to easily manage the installation of gems, and a server for distributing them.

Which of the following commands will be verify the existence of the RubyGems in your system?

Use $ gem list | grep YOURGEM to check if the YOURGEM is present.


1 Answers

I think I figured out the answer to this question, so I'll post it.

Rbenv allows for a global and/or local version of ruby. So once a ruby is installed and managed via rbenv, you can declare it as a global ruby version used by your entire system.

Likewise, you can declare a local ruby version within a given directory (ex: a specific rails project).

The .gem file in your home path is used by the global ruby version, where as the one tucked away in the rbenv directory is used by the local ruby version.

Note, you can (for whatever reason) declare a local version that is the same as the global version. In that case, the local version will rely on the gem files that are in the deeper rbenv directory, instead of the ~/.gem directory.

like image 50
Nathan Avatar answered Nov 16 '22 02:11

Nathan