Skip to content
Automatically run Ruby scripts with "bundle exec" (but only when appropriate).
Find file
Pull request Compare This branch is 58 commits behind master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


bundler-bin provides a Bash function that updates your PATH environment variable to include a project's ./bin directory if the project's Ruby gem dependencies are being managed with bundler.

You can find bundler here:

Gems that are managed by bundler will install their scripts in a directory called <project-root>/bin, and you should run these commands in preference to the commands that are installed with your system's gems. If your project's bin directory is not in your path it's very easy to forget to specify the correct command, which can cause no end of subtle problems. bundler-bin fixes this problem by automatically updating your PATH as you change directories. It defines a function for updating PATH via the Bash PROMPT_COMMAND hook.

bundler-bin requires Bash 3.0 or greater to work.


  1. Copy to ~/
  2. Set PROJECT_ROOT to the parent directory of your bundled projects (e.g. ~/code). Why is this needed? See update_bundler_path in the code.
  3. Source it from your ~/.bashrc file.

For example:

$ cp bundler-bin/ ~/
$ echo "PROJECT_ROOT=$HOME/code" >> ~/.bashrc
$ echo "[ -f ~/ ] && source ~/" >> ~/.bashrc

That's it... cd into a bundled project and try echo $PATH to see if it works!

Something went wrong with that request. Please try again.