Rails bundler: how to undo bundle package? Rails bundler: how to undo bundle package? ruby ruby

Rails bundler: how to undo bundle package?


As per this answer: https://stackoverflow.com/a/9471980/219883

You must delete the hidden .bundle directory, then re-run bundle install - otherwise it will continue to add the vendor/cache directory back every time.


But if you just to remove a particular gem, then remove/comment the name of the gem from your project/Gemfile and then run bundle.

To prevent gem files from being added to the vendor/cache directory delete the vendor/cache directory from your project root.

The next time you will run bundle install gems won't create a vendor/cache folder.

Later on in your project if you need the vendor/cache folder all you'll have to do is to create the folder vendor/cache again.


.bundle/config is telling bundler to put things in vendor/cache. Either remove the following two lines from .bundle/config or remove .bundle/config itself.

---BUNDLE_PATH: vendor/cacheBUNDLE_DISABLE_SHARED_GEMS: '1'

Then run the following command to remove vendor/cache:

rm -rf vendor/cache

The next time you run bundle install you will not have this problem.