Its a well known best practice to use run executables using bundle exec <command>
and not just the command. But it seems like nobody could explain why its better to run executebles via bundle exec
. So I ask yo why,...?
Asked
Active
Viewed 601 times
3

tobiasbayer
- 10,269
- 4
- 46
- 64

davidb
- 8,884
- 4
- 36
- 72
1 Answers
4
If you are using bundle exec instead of just executing command, bundler makes some changes to your environment variable, so all gems listed in your Gemfile can be accessed successfully. You can see http://gembundler.com/man/bundle-exec.1.html . Also, bundler can install gems into custom path instead of system location and then they still will be accessible for require if you are using bundle exec
. See also http://gembundler.com/man/bundle-install.1.html
So in general answer is: to isolate your set of gems from system gems and to make them available for you application in case of custom gem location.

Volodymyr Rudyi
- 638
- 11
- 25