Reputation: 3168
On my home box the bundle install
command asks for my password and installs the gems in
/var/lib/gems/1.8/gems/...
But on my office computer they are installed in ~/.bundler/cache/git
(or at least cached there) and not installed in the main filesystem.
I can’t figure out how to set the path they are installed in. Please help!
Upvotes: 13
Views: 24524
Reputation: 135
As Mohamed Hakki noted, the other answer is now deprecated.
You can now set the target path for Bundler using:
bundle config set --local path vendor/bundle
Here we specify the path vendor/bundle
(which in my experience seems to be the most common and “standard” path), but you can specify any path you want (including ~/.bundler
).
This command actually creates a file within your working directory, .bundle/config
, with the contents:
---
BUNDLE_PATH: "vendor/bundle"
Of course, we are using vendor/bundle
as an example, but the BUNDLE_PATH
will be whatever you specified as the path in the command invocation.
Once this file is in your working directory, all invocations of Bundler from the same working directory will use the path you specified.
Upvotes: 13
Reputation: 1970
You can specify where the gems are installed by using
bundle install --path [directory]
This is not normally necessary; you can usually just do 'bundle install' and you're good to go.
When you want to include the gems for deployment, you will want to use
bundle package
which will, by default, put your gems in ./vendor/cache. If you subsequently deploy the project and do
bundle install --deployment
Bundler will source the files from that directory and install them into ./vendor/bundle. More information is available by doing
bundle help install
Hope this is useful.
Upvotes: 11