Beast_Code
Beast_Code

Reputation: 3247

OS X El Capitan - Can't install bundler using gem

I just installed El Capitan and had to install rails. I am trying to install bundler but am getting the following error. I found this answer on stackexchange but seems like i would be messing with a security issue https://apple.stackexchange.com/questions/204312/cant-install-bundler-using-gem

sudo gem install bundler --no-ri --no-rdoc
Password:
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/bundle

update:

$ rvm gem install bundler --no-ri --no-rdoc
Please note that `rvm gem ...` was removed, try `gem install bundler --no-ri --no-rdoc` or `rvm all do gem install bundler --no-ri --no-rdoc` instead. ( see: 'rvm usage' )
$ gem install bundler --no-ri --no-rdoc
Fetching: bundler-1.10.6.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
$ sudo gem install bundler --no-ri --no-rdoc
Password:
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/bundle
$ rvm all do gem install bundler --no-ri --no-rdoc
$ bundle
zsh: command not found: bundle
$ sudo gem install bundler --no-ri --no-rdoc
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/bundle
$ rvm gem install bundler --no-ri --no-rdoc
Please note that `rvm gem ...` was removed, try `gem install bundler --no-ri --no-rdoc` or `rvm all do gem install bundler --no-ri --no-rdoc` instead. ( see: 'rvm usage' )
$ rvm gem install bundle --no-ri --no-rdoc
Please note that `rvm gem ...` was removed, try `gem install bundle --no-ri --no-rdoc` or `rvm all do gem install bundle --no-ri --no-rdoc` instead. ( see: 'rvm usage' )

Upvotes: 1

Views: 1322

Answers (3)

vaichidrewar
vaichidrewar

Reputation: 9621

From https://github.com/bundler/bundler/issues/4065

You'll need to either change your GEM_HOME or do

sudo gem install bundler -n /usr/local/bin 

because of El Cap's introduction of SIP (System Integrity Protection).

Upvotes: 1

Jim
Jim

Reputation: 475

You are probably running into El Capitan's new feature System Integrity Protection.

However, you don't really want to install your gems and stuff for development in your system ruby. I did that for many years, but really, save yourself the headaches and use RVM or rbenv.

Upvotes: 2

halfelf
halfelf

Reputation: 10107

OS X 10.11 has a so-called "rootless" feature, which forbidden users to modify /usr directory. The only exception is /usr/local. So sudo is useless here. I suggest using rbenv to install a new ruby installation somewhere else.

Upvotes: 0

Related Questions