Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does bundler store gems?

I know that when using gem install, the gem will be stored under /home/username/.rvm/gems/, under which gemset the gem was installed.

But if I use Bundler and specify the gem in the Gemfile, when I run bundle install, where will those gems be stored? And what if I already installed the gem using gem install, if I run bundle install, will it use the previous gem installed using gem install?

like image 356
gerky Avatar asked Jul 24 '12 16:07

gerky


People also ask

Where is my gem file located?

The Gemfile is wherever you want it to be - usually in the main directory of your project and the name of the file is Gemfile . It's convenient to have one because it allows you to use Bundler to manage which gems and which versions of each your project needs to run.

Where does Ruby bundler install gems?

Show activity on this post. I know that when using gem install , the gem will be stored under /home/username/. rvm/gems/, under which gemset the gem was installed.

Where are gems installed Mac?

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


2 Answers

If you want to find out where a particular gem is stored you can run bundle info <gem-name>. For example:

user@host$ bundle info rake /var/bundle/ruby/2.1.0/gems/rake-10.4.2 

For older versions of rake, the command could be bundle show <gem_name>.

like image 126
James Kingsbery Avatar answered Oct 09 '22 04:10

James Kingsbery


It depends. In the usual development setup they are installed where they would be when you install a gem "normally" (by running gem install foo) and bundler won't reinstall gems that are already there. This location depends on how rubygems itself is configured.

If you run bundle install with the --deployment option then the gems will be installed in a location unique to your app (you can pass this as a separate option but it defaults to vendor/bundle)

You can also run bundle package to store all the .gem files your app uses in vendor/cache. Running bundle install will prefer gems in vendor/cache to gems in other locations.

like image 40
Frederick Cheung Avatar answered Oct 09 '22 03:10

Frederick Cheung