If you’re working in Ruby, you’re probably using Bundler. And if you’re using bundler, you’ll probably know that typing bundle install foo will install your bundle to a directory called foo.

Of course, the problem is that Bundler remembers this configuration, and if you now run bundle install, you’ll install your bundle to… foo.

This is annoying. It’s especially annoying if you never meant to install to foo, and that was just a typo.

So: if you want to reset bundler to installing to the default location – which is your system’s current gem folder – you’re going to spend up a good hour messing around on Google looking for a plain English solution.

Can you guess who did this, and who this article is written for? That’s right, it’s me in the past!

Your solution: just run bundle install --system. That’ll install your bundle to the default system location – and continue to do so in the future. Problem solved.

(As usual, when I write about how to do something technically, it’s because I couldn’t find the answer. That’s all.)

3 comments on this entry.

  • Paul Hammond | 8 Jul 2011

    For future reference, you can also delete the .bundle folder in the root of your application, which will delete all of bundler’s state.

  • Richard Paul | 13 Jul 2011

    Thanks for the tip, I got myself into a mess for a similar reason.
    $ bundle install help
    Hoping to get some docs on how to use install, instead it installed all my gems into help/jruby.
    Deleting the .bundle directory fixed my problem.

  • Matt | 29 Oct 2011

    Thanks for this. I did exactly like you did…bundle install [gem name]. There went 30 minutes of my life.