Antarr Byrd Antarr Byrd - 1 year ago 200
Ruby Question

Bundle not working with rbenv

I'm trying to use bundler with rbenv. I has been working until today. The only thing I may have done to break it was

gem pristine --all
gem cleanup
? When trying to install bundler i get the following error.

Antarrs-MacBook-Pro:some-app antarrbyrd$ sudo gem install bundler
Bundler gave the error "Could not find mail-2.5.4 in any of the sources" while processing "/Users/antarrbyrd/dev/some-app/Gemfile". Perhaps you forgot to run "bundle install"?
Successfully installed bundler-1.7.12
Parsing documentation for bundler-1.7.12
Done installing documentation for bundler after 3 seconds
1 gem installed
Antarrs-MacBook-Pro:some-app antarrbyrd$ bundle install
/Users/antarrbyrd/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'bundler' (>= 0) among 8 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/antarrbyrd/.gem', execute `gem env` for more information
from /Users/antarrbyrd/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/dependency.rb:324:in `to_spec'
from /Users/antarrbyrd/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /usr/local/bin/bundle:22:in `<main>'

when i do
rbenv rehash
rbenv bundler on
it get this error

Bundler gave the error "Could not find mail-2.5.4 in any of the sources" while processing "/Users/antarrbyrd/dev/some-app/Gemfile". Perhaps you forgot to run "bundle install"?


export BUNDLER_EDITOR=atom
export PATH=$PATH:/usr/local/opt/android-sdk/build-tools/21.1.2

export ANDROID_HOME=/usr/local/opt/android-sdk
export PATH="$HOME/.rbenv/bin:$PATH"
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

# Allow local Gem Managment
# export GEM_HOME="$HOME/.gem"
# export GEM_PATH="$HOME/.gem"
# export PATH="$HOME/.gem/bin:$PATH"

gem env

RubyGems Environment:
- RUBY VERSION: 2.1.2 (2014-05-08 patchlevel 95) [x86_64-darwin14.0]
- INSTALLATION DIRECTORY: /usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0
- RUBY EXECUTABLE: /usr/local/var/rbenv/versions/2.1.2/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/var/rbenv/versions/2.1.2/bin
- SPEC CACHE DIRECTORY: /Users/antarrbyrd/.gem/specs
- ruby
- x86_64-darwin-14
- /usr/local/var/rbenv/versions/2.1.2/lib/ruby/gems/2.1.0
- /Users/antarrbyrd/.gem/ruby/2.1.0
- :update_sources => true
- :verbose => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "-n/usr/local/bin"
- /usr/local/var/rbenv/versions/2.1.2/bin
- /usr/local/Cellar/rbenv/0.4.0/libexec
- /Users/antarrbyrd/.gem/bin
- /usr/local/var/rbenv/shims
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/var/rbenv/shims
- /Users/antarrbyrd/.rbenv/bin
- /Users/antarrbyrd/.rbenv/shims
- /Users/antarrbyrd/.gem/bin
- /usr/local/opt/android-sdk/build-tools/21.1.2


I reinstalled rbenv via brew and now I get the following error when running bundle install.

The `bundle' command exists in these Ruby versions:

response to Joel

Antarrs-MacBook-Pro:myapp antarrbyrd$ command -v ruby
Antarrs-MacBook-Pro:myapp antarrbyrd$ command -v bundle
Antarrs-MacBook-Pro:myapp antarrbyrd$ ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin14.0]
Antarrs-MacBook-Pro:myapp antarrbyrd$ bundle -v
Bundler version 1.7.12
Antarrs-MacBook-Pro:myapp antarrbyrd$

Answer Source

Your installation is caught in a loop.

Change to a directory that is not your app, and that doesn't have a Gemfile.

Then do the usual gem install bundle (and use sudo if you need it)

Then change to your app directory, and do the usual bundle install.

Does that solve your issue?

If you need more help, can run these commands then paste the results in your question?

 $ command -v ruby
 $ command -v bundle
 $ ruby -v
 $ bundle -v

Look for any mismatch between the results and what you expect. This will help you track down what's happening. You may need to update your Gemfile Ruby version.

(Also, you may want to consider changing from rbenv to chruby because it's better IMHO with these kinds of path issues)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download