Where does bundler store gems?
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.
Why Bundle Install is installing gems in vendor/bundle?
Use
bundle env
to view paths and bundle configurationAfter this set bundle path to
~/.rvm/gems/ruby-2.0.0-p247
like this:bundle install --path ~/.rvm/gems/ruby-2.0.0-p247
which is global and also you can use your own custom path.
Post this
bundle install
will never needpath
again and will always install all of your gems in thatdirectory(~/.rvm/gems/ruby-2.0.0-p247 in my case
) for that app not inapp_folder/vendor/bundle
Bundler: install local gem with system gems
No, Bundler treats path gems differently and does not install them to your GEM_PATH
. This is so that you don't need to reinstall as you make changes.
It is not normal or necessary for a gem to point to itself or its runtime dependencies in its Gemfile
. You might want to add gemspec
to do this automatically. See http://bundler.io/v1.3/rubygems.html
How to find where gem files are installed
Use gem environment
to find out about your gem environment:
RubyGems Environment:
- RUBYGEMS VERSION: 2.1.5
- RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [x86_64-darwin12.4.0]
- INSTALLATION DIRECTORY: /Users/ttm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /Users/ttm/.rbenv/versions/2.0.0-p247/bin/ruby
- EXECUTABLE DIRECTORY: /Users/ttm/.rbenv/versions/2.0.0-p247/bin
- SPEC CACHE DIRECTORY: /Users/ttm/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-12
- GEM PATHS:
- /Users/ttm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0
- /Users/ttm/.gem/ruby/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/ttm/.rbenv/versions/2.0.0-p247/bin
- /Users/ttm/.rbenv/libexec
- /Users/ttm/.rbenv/plugins/ruby-build/bin
- /Users/ttm/perl5/perlbrew/bin
- /Users/ttm/perl5/perlbrew/perls/perl-5.18.1/bin
- /Users/ttm/.pyenv/shims
- /Users/ttm/.pyenv/bin
- /Users/ttm/.rbenv/shims
- /Users/ttm/.rbenv/bin
- /Users/ttm/bin
- /usr/local/mysql-5.6.12-osx10.7-x86_64/bin
- /Users/ttm/libsmi/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/bin
Notice the two sections for:
INSTALLATION DIRECTORY
GEM PATHS
Bundler installing gem that's already installed
Try running bundle env
to verify that the install location is what you expect.
If not, check whether there is a .bundle/config
or ~/.bundle/config
file overriding the install path. The output of bundle env
will tell you what configuration it is using and how it was determined (i.e., which file it was in or whether it was picked up from an environment variable).
Related Topics
How to Capitalize the First Letter in a String in Ruby
Ruby: Most Concise Way to Use an Env Variable If It Exists, Otherwise Use Default Value
Does Ruby Have a String.Startswith("Abc") Built in Method
Ruby: Module, Require and Include
Rails 3 - Restricting Formats for Action in Resource Routes
Combinatory Method Like Tap, But Able to Return a Different Value
In Ruby, What Structures Can a 'Rescue' Statement Be Nested In
Does Dependency Injection Exist in Rails
Indentation Sensitive Parser Using Parslet in Ruby
Ruby on Rails: Permission Denied When Using "Rails Generate Controller Welcome"
All Ruby Tests Raising: Undefined Method 'Authenticate' for Nil:Nilclass
When We Import CSV Data, How Eliminate "Invalid Byte Sequence in Utf-8"
What's the Opposite of Chr() in Ruby
Active Admin: Customize Only New Form
What Is the Use of "#!/Usr/Local/Bin/Ruby -W" at the Start of a Ruby Program
How to Unit-Test a JSON Controller
Check If User Is Active Before Allowing User to Sign in with Devise (Rails)
How to Password-Protect My /Sidekiq Route (I.E. Require Authentication for the Sidekiq::Web Tool)