user3399101
user3399101

Reputation: 1537

When I run gem install *some gem name* where does it install?

As the question states - where does the gem install?

Is it installing within the app directory that I'm working in (i.e. user/sites/sample_app)? Or is it being installed on my computer? If the latter where exactly?

Thanks!

Upvotes: 1

Views: 335

Answers (5)

Richard Peck
Richard Peck

Reputation: 76774

Gems

If you use gem install x, you're adding the gem to the local ruby version on your system. This is a system-wide installation, and will be stored in your rubylib/ruby/gems dir:

The install command downloads and installs the gem and any necessary dependencies then builds documentation for the installed gems.


Bundler

Using the bundle install command (when you have a Gemfile & use bundler), you basically tell bundler to install the gems relative to your specific applicaiton:

Bundler makes sure that Ruby can find all of the gems in the Gemfile (and all of their dependencies). If your app is a Rails 3 app, your default application already has the code necessary to invoke bundler. If it is a Rails 2.3 app, please see Setting up Bundler in Rails 2.3.

For example, if you have a Rails 3.2 app, and a Rails 4.1 app on your system, using bundler allows you to instal the dependencies (gems) for each app independently

If you use gem install x, it will install the gem for all applications, and should only be used for things like rmagick and the database connection gems

Upvotes: 0

LukasMac
LukasMac

Reputation: 898

If you want to know where gem is installed use gem which *gem_name* e.g.:

gem which rails

If you installed your gems with bundle install use bundle show *gem name* e.g.:

bundle show rails

Upvotes: 0

vinodh
vinodh

Reputation: 2124

gem install process

first download gem and save desktop 1.next step open command prompt and set location that means c:/desktop> gem install --local "gemname" 2.next step com to rails consoler and type $bundle install --local. 3. type the gem name on gem list

Upvotes: 1

Pramod Shinde
Pramod Shinde

Reputation: 1892

If you are using rvm then its get installed in

/home/user/.rvm/gems/ruby-version@global/ or /home/user/.rvm/gems/ruby-version/

If you are using specific gemset for gems then

/home/user/.rvm/gems/ruby-version@gemset_name/

Upvotes: 0

Chuanpin Zhu
Chuanpin Zhu

Reputation: 2256

I have two questions:

Where do you install your ruby?

Did you use RVM or rbenv?

Now I will explain your question using my situation as an example.

I use RVM to manage rubies on my mac os.

now the ruby install in path

/Users/pin/.rvm/rubies/ruby-2.1.1

and these will be a gems directory under .rvm path. In this directory,

/Users/pin/.rvm/gems

there are many gems group, I have a group named

ruby-2.1.1@global

which is used by the default ruby version.

This is a directory and there will be a gems directory under it.

/Users/pin/.rvm/gems/ruby-2.1.0/gems

In this directory, you will find all of the gems you installed using cmd

bundle install

If you don't use ruby version management tools like rvm or rbenv, you may find the gems

around your ruby path. If you still can't find them, you can post the details of how you

install the rubies and other system configs, so that we can discuss here.

Upvotes: 0

Related Questions