title: rbenv — 'find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
body: <p>I'm new to rbenv (was using RVM for long time). Today I do clean uninstall of my RVM and install rbenv. I managed to install Ruby 2.5.1 without any issues.</p>
  
  <p>But when I try to run <code>bundle install</code> for a project today, I got the following error:</p>
  
  <p><code>'find_spec_for_exe': can't find gem bundler (&gt;= 0.a) with executable bundle (Gem::GemNotFoundException)</code></p>
  
  <p>Seems like something is broken with my bundler installation but I'm not sure what is wrong. Running <code>gem install bundler</code> with <code>sudo</code> doesn't solve the problem.</p>
  
  <p>Here is the full trace:</p>
  
  <pre><code>$ echo $SHELL
  /bin/zsh
  
  
  $ cat ~/.gemrc
  gem: --no-document
  install: --no-document
  update: --no-document
  
  
  $ rbenv versions
    system
  * 2.5.1 (set by /Users/zulh/.rbenv/version)
  
  
  $ ruby -v
  ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin16]
  
  
  $ which ruby
  /Users/zulh/.rbenv/shims/ruby
  
  
  $ gem env
  RubyGems Environment:
    - RUBYGEMS VERSION: 2.7.6
    - RUBY VERSION: 2.5.1 (2018-03-29 patchlevel 57) [x86_64-darwin16]
    - INSTALLATION DIRECTORY: /Users/zulh/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0
    - USER INSTALLATION DIRECTORY: /Users/zulh/.gem/ruby/2.5.0
    - RUBY EXECUTABLE: /Users/zulh/.rbenv/versions/2.5.1/bin/ruby
    - EXECUTABLE DIRECTORY: /Users/zulh/.rbenv/versions/2.5.1/bin
    - SPEC CACHE DIRECTORY: /Users/zulh/.gem/specs
    - SYSTEM CONFIGURATION DIRECTORY: /Users/zulh/.rbenv/versions/2.5.1/etc
    - RUBYGEMS PLATFORMS:
      - ruby
      - x86_64-darwin-16
    - GEM PATHS:
       - /Users/zulh/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0
       - /Users/zulh/.gem/ruby/2.5.0
    - GEM CONFIGURATION:
       - :update_sources =&gt; true
       - :verbose =&gt; true
       - :backtrace =&gt; false
       - :bulk_threshold =&gt; 1000
       - "gem" =&gt; "--no-document"
       - "install" =&gt; "--no-document"
       - "update" =&gt; "--no-document"
    - REMOTE SOURCES:
       - https://rubygems.org/
    - SHELL PATH:
       - /Users/zulh/.rbenv/versions/2.5.1/bin
       - /usr/local/Cellar/rbenv/1.1.1/libexec
       - /Users/zulh/.rbenv/shims
       - /usr/local/bin
       - /Users/zulh/go/bin
       - /usr/local/bin
       - /Users/zulh/go/bin
       - /Users/zulh/.rbenv/shims
       - /usr/local/bin
       - /Users/zulh/go/bin
       - /Users/zulh/.rbenv/shims
       - /usr/local/bin
       - /Users/zulh/go/bin
       - /usr/local/bin
       - /usr/bin
       - /bin
       - /usr/sbin
       - /sbin
       - /Library/Frameworks/Mono.framework/Versions/Current/Commands
       - /Applications/Postgres.app/Contents/Versions/latest/bin
       - /Users/zulh/projects/tifig/build/tifig
       - /Applications/Postgres.app/Contents/Versions/latest/bin
       - /Users/zulh/projects/tifig/build/tifig
       - /Applications/Postgres.app/Contents/Versions/latest/bin
       - /Users/zulh/projects/tifig/build/tifig
       - /Applications/Postgres.app/Contents/Versions/latest/bin
       - /Users/zulh/projects/tifig/build/tifig
       - /Applications/Postgres.app/Contents/Versions/latest/bin
  
  
  $ which bundler
  /Users/zulh/.rbenv/shims/bundler
  
  
  $ bundler --version
  Traceback (most recent call last):
      2: from /Users/zulh/.rbenv/versions/2.5.1/bin/bundler:23:in `&lt;main&gt;'
      1: from /Users/zulh/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
  /Users/zulh/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (&gt;= 0.a) with executable bundler (Gem::GemNotFoundException)
  
  
  $ cd projects/www.ruby-lang.org
  
  
  $ bundle install --without production
  Traceback (most recent call last):
      2: from /Users/zulh/.rbenv/versions/2.5.1/bin/bundle:23:in `&lt;main&gt;'
      1: from /Users/zulh/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
  /Users/zulh/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (&gt;= 0.a) with executable bundle (Gem::GemNotFoundException)
  
  
  $ sudo gem install bundler
  Password:
  Successfully installed bundler-2.0.1
  1 gem installed
  
  
  $ which bundler
  /Users/zulh/.rbenv/shims/bundler
  
  
  $ bundler --version
  Traceback (most recent call last):
      2: from /Users/zulh/.rbenv/versions/2.5.1/bin/bundler:23:in `&lt;main&gt;'
      1: from /Users/zulh/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
  /Users/zulh/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (&gt;= 0.a) with executable bundler (Gem::GemNotFoundException)
  
  
  $ bundle install --without production
  Traceback (most recent call last):
      2: from /Users/zulh/.rbenv/versions/2.5.1/bin/bundle:23:in `&lt;main&gt;'
      1: from /Users/zulh/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
  /Users/zulh/.rbenv/versions/2.5.1/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (&gt;= 0.a) with executable bundle (Gem::GemNotFoundException)
  </code></pre>
  
  <p>How to fix this issue?</p>
  
  <p>Note: I'm using OSX 10.12.6</p>