Whenever I do bundle install
all of the gems get installed at
app_dir/vendor/bundle
path and consumes loads of disk space. I also tried installing gems where it should get installed i.e gemsets while development by this:
bundle install --no-deployement
but this isn't working for me and installeing gems at vendor/bundle
. How can I make it to be installed globally for all applications or in ruby gemsets location ? I also tried removing .bundle/config
but nothing changed.
I am using:
rvm version: 1.23.14 ruby version: 2.0.0-p247 rails 3.2.13
Here is my ~/.bash_profile
:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin eval "$(rbenv init -)" alias pg='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log' [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
My ~/.bashrc
:
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
Some other information that you might need:
aman@Amandeeps-MacBook-Pro ~/Projects/qe (develop)*$ which bundle /Users/aman/.rvm/gems/ruby-2.0.0-p247@global/bin/bundle aman@Amandeeps-MacBook-Pro ~/Projects/qe (develop)*$ rbenv which bundle /Users/aman/.rbenv/versions/2.0.0-p247/bin/bundle amandeep@Amandeeps-MacBook-Pro ~/Projects/qe (develop)*$ rbenv which ruby /Users/aman/.rbenv/versions/2.0.0-p247/bin/ruby aman@Amandeeps-MacBook-Pro ~/Projects/qe (develop)*$ rbenv gemset active rbenv: NO such command `gemset' aman@Amandeeps-MacBook-Pro ~/Projects/qe (develop)*$ which rails /Users/aman/.rvm/gems/ruby-2.0.0-p247@global/bin/rails
I tried this also but didn't helped:
bundle install --system
and removing .bundle
directory.
Please help me in installing gems in gemsets not vendor/bundle
or a default place.
The location to install the gems in the bundle to. This defaults to Rubygems' gem home, which is also the default location where gem install installs gems. This means that, by default, gems installed without a --path setting will show up in gem list . This setting is a remembered option.
Almost seems like running 'gem install' adds it to the global available gems (and hence terminal can run the package's commands), whereas adding it to the gemfile and running bundle install only adds it to the application. Similar to npm install --global. that's basically it.
In the invoked popup, start typing bundler, select bundle install and press Enter . Select Tools | Bundler | Install from the main menu. Open the Gemfile, place the caret at any highlighted gem missing in the project SDK and press Alt+Enter . Select Install missing gems using 'bundler' and press Enter .
The commands bundle & bundle install also have the same functionality. bundle uses Thor, and bundle 's default task is install .
In your project folder you will have .bundle
directory that holds configuration for bundler
. try deleting that folder. it should reset the install path for your gems back to system-wide settings.
In the case you just want to edit the install path, opening .bundle/config
with your favorite editor should show you the path to vendor/bundle
. Removing that line will restore it to defaults without removing other configs you might have.
Also, another less frequent scenario is your system-wide settings being messed up. According to @NaoiseGolden:
I had to delete
.bundle
from my Home folder (rm -rf ~/.bundle). You can check out your configuration runningbundle env
Try installing using
bundle install --system
I think initially the bundle install was run with --path
flag and bundler now rememebers that confguration.
From the bundler man page
Some options are remembered between calls to bundle install, and by the Bundler runtime.
Subsequent calls to bundle install will install gems to the directory originally passed to --path. The Bundler runtime will look for gems in that location. You can revert this option by running bundle install --system.
EDIT: As mentioned in comments below, and also otherwise, this installs the gems system wide. In case you are using rvm etc to manage your environment for different apps, check @IuriG's answer mentioned above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With