Brant Barton
Brant Barton

Reputation: 458

bundle install extensions?

I know there's more than one extension for bundle Install, but what exactly does:

 bundle install --binstubs

do compared to a normal

 bundle install 

?

Upvotes: 0

Views: 86

Answers (1)

Jim Stewart
Jim Stewart

Reputation: 17323

Not sure what you mean by extensions in this context, but the difference is that bundle install --binstubs creates a ./bin directory, and places links in that directory to any binaries your gems install. For example, the rspec gem comes with an rspec binary. In order to make sure the proper version of RSpec is run when you type it at the command line, you can place the project-specific bin directory in your shell's executable search path.

The problem Bundler is trying to solve here is that you can install multiple versions of a gem (like rspec), and your shell needs a way to find the right version to execute. One solution is using --binstubs and altering your PATH to include it at the beginning (either the relative path, which isn't the best idea in the world, or the absolute path, which you'd have to configure for each project).

Alternatives to --binstubs are to prefix all gem commands with bundle exec (like bundle exec rspec), to ensure that the appropriate version is run based on your project's Gemfile, or to use RVM and gemsets.

It's all a bit complicated, and the Bundler documentation is pretty terrible when it comes to explaining this.

Upvotes: 1

Related Questions