31

I cloned a repository and tried to run rails s. However, I received the following error:

/Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- bundler/setup (LoadError)
from /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/me/workspace/bindo/config/boot.rb:7:in `<top (required)>'
from /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from bin/rails:9:in `<main>'

My ruby version is:

ruby 1.9.3p547 (2014-05-14 revision 45962) [x86_64-darwin13.3.0]

My gem env command run from this project directory:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.23.2
  - RUBY VERSION: 1.9.3 (2014-05-14 patchlevel 547) [x86_64-darwin13.3.0]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/2.0.0
  - RUBY EXECUTABLE: /Users/me/.rbenv/versions/1.9.3-p547/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/lib/ruby/gems/2.0.0/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-13
  - GEM PATHS:
     - /usr/lib/ruby/gems/2.0.0
     - /Users/me/.gem/ruby/1.9.1
     - /Users/me/.rbenv/versions/1.9.3-p547/lib/ruby/gems/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

I read on Stack Overflow that this is a path error, however, I am not familiar enough to figure out what to trace or change to make this work. I'm looking but I feel I need some direction.

1
  • 2
    [sudo] gem install bundler && bundler install Oct 25, 2014 at 8:53

2 Answers 2

78

You likely have bundler gem missing.

To get it to work run (first command may need be executed with sudo, depending on your environment):

[sudo] gem install bundler
bundle install
2
  • For windows users, install gem first by using rubyinstaller + devkit, do step 1 and 2 then use "gem" in "cmd".
    – Miae Kim
    Oct 5, 2015 at 20:23
  • 1
    It didnot work for Mac OS 10.12.6, ruby 1.9.3p551, gem 2.6.13, Rails 3.2.19, Bundler version 1.15.4. Continuing research for this issue. Oct 1, 2017 at 20:37
1

On the mac, it is possible that you installed gems to ./vendor/bundle in order to avoid to use SUDO. You can find it if you run gem install bundler and at the end of the output you see the following:

Using turbolinks-source 5.1.0
Using turbolinks 5.1.0
Using uglifier 4.1.4
Bundle complete! 13 Gemfile dependencies, 68 gems now installed.
Bundled gems are installed into `./vendor/bundle`

If this is the case than in your app root directory delete the bundle directory. After this run the following commands:

[sudo] gem install bundler
bundle install

It solved the problem for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.