0

When I run bundle install I get the following error. Like if I run bundle -v

/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:318:in `to_specs': Could not find 'bundler' (>= 0) among 13 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/john/.gem/ruby/2.0.0:/Library/Ruby/Gems/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0', execute `gem env` for more information
    from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:327:in `to_spec'
    from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /usr/local/bin/bundle:22:in `<main>'

Here is my ruby gem env

    RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.4
  - RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-darwin15]
  - INSTALLATION DIRECTORY: /Users/john/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
  - USER INSTALLATION DIRECTORY: /Users/john/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /Users/john/.rbenv/versions/2.3.1/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/john/.rbenv/versions/2.3.1/bin
  - SPEC CACHE DIRECTORY: /Users/john/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/john/.rbenv/versions/2.3.1/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-15
  - GEM PATHS:
     - /Users/john/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
     - /Users/john/.gem/ruby/2.3.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/john/.rbenv/versions/2.3.1/bin
     - /usr/local/Cellar/rbenv/0.4.0/libexec
     - /usr/local/bin
     - /usr/local/sbin
     - /Users/john/.rbenv/shims
     - /Users/john/.rbenv/bin
     - /usr/bin
     - /usr/local/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin

Here is which bundler

/usr/local/bin/bundler
Dave Schweisguth
  • 36,475
  • 10
  • 98
  • 121
ja11946
  • 177
  • 1
  • 2
  • 13
  • Possible duplicate of ["Could not find bundler" error](http://stackoverflow.com/questions/6166081/could-not-find-bundler-error) – Dave Schweisguth May 20 '16 at 14:12
  • Is your environment set correctly? what does your Gemfile look like? rbenv or rvm? – mahatmanich May 20 '16 at 14:56
  • Are your binstubs generated? – mahatmanich May 20 '16 at 14:57
  • I am using el capitan with rbenv. When I type which bundler I get /usr/local/bin/bundler here is the echo $PATH /usr/local/bin:/usr/local/sbin:/Users/john/.rbenv/shims:/Users/john/.rbenv/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin – ja11946 May 20 '16 at 15:23
  • Did you try gem install bundler? – ruby_newbie May 20 '16 at 15:28
  • I tried gem install bundler, it installs, then I type bundler and I get /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:318:in `to_specs': Could not find 'bundler' (>= 0) among 13 total – ja11946 May 20 '16 at 15:30
  • did you try "bundle update"? If that doesn't work try gem install bundle (notice bundle not bundler) – ruby_newbie May 20 '16 at 16:37

1 Answers1

1

Turns out the $PATH was set incorrectly, the bin was in front of the rbenv. so it was choosing the wrong bundler. Here is the path now:

/Users/john/.rbenv/shims:/Users/john/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

with .rbenv in front of local/bin all is good

ja11946
  • 177
  • 1
  • 2
  • 13