Ruby on Rails

rbenv: bundle: command not found

When you get the rbenv: bundle: command not found error it is most likely the case that you have installed a new Ruby version and you are trying to run a bundle command inside an existing project directory. For every new Ruby version you install, you also need to install the Bundler gem. This minipost will help understanding the case.

Most likely, it seems that you have recently tried to update your rbenv Ruby version and then tried to run bundle install inside an existing project.

$ bundle install

Your console outputs the following error:

rbenv: bundle: command not found

The `bundle' command exists in these Ruby versions:
2.6.0
[…]

The output informs that rbenv was unable to find the bundle command, because you have only installed bundler on other Ruby versions listed on the above snippet. The output contains the Ruby versions of your development machine system that have Bundler installed. Therefore, bundler is not installed in the Ruby version you are using inside this project. Let’s try and list the available bundler versions for the rbenv Ruby version:

$ gem list bundler       

The output of this command will be empty, like the following:

*** LOCAL GEMS ***

As we expected, there are no local bundler gems for rbenv’s Ruby version. You should install bundler in order to proceed.

To install a specific version of bundler or just run the following command to install the latest available bundler:

$ gem install bundler       

Verify that you have a bundler installed by:

$ gem list bundler       

The output should be similar to the following:

*** LOCAL GEMS ***
bundler (1.17.2)

You now are able to perform a bundle install or any other bundle related command inside your existing application with upgraded Bundler and Ruby version.

Buy Me A Coffee

Read also the following