Search code examples
rubymacosrubygemsbundler

How to fix Ruby gem bundler installation?


Looks like bundler is installed in my machine but I am getting an error while I run bundle -v.

Error:

/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:308:in `to_specs': Could not find 'bundler' (>= 0) among 71 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/username/.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:320:in `to_spec'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
from /usr/local/bin/bundle:22:in `<main>'

I am not sure about what's wrong!

Update:

I was unable to find bundler from gem list

When I run which bundle, I see the output as /usr/local/bin/bundle and in that location I see bundle and bundler executables.

When I run sudo gem install bundler, I get the below error

ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/bundle

Solution

  • Fixed it by disabling System Integrity Protection.

    To disable SIP restart your MAC in recovery mode by holding Command+R and open terminal from utilities and running csrutil disable.