简体   繁体   English

OS X El Capitan - 无法使用gem安装bundler

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

I just installed El Capitan and had to install rails. 我刚刚安装了El Capitan,不得不安装导轨。 I am trying to install bundler but am getting the following error. 我正在尝试安装bundler但是收到以下错误。 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 我在stackexchange上找到了这个答案,但好像我会搞乱安全问题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' )

You are probably running into El Capitan's new feature System Integrity Protection . 您可能正在使用El Capitan的新功能系统完整性保护

However, you don't really want to install your gems and stuff for development in your system ruby. 但是,您真的不想在系统ruby中安装您的宝石和东西进行开发。 I did that for many years, but really, save yourself the headaches and use RVM or rbenv . 我这样做了很多年,但实际上,除了头痛并使用RVMrbenv之外

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

You'll need to either change your GEM_HOME or do 你需要改变你的GEM_HOME或者做

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

because of El Cap's introduction of SIP (System Integrity Protection). 因为El Cap引入了SIP(系统完整性保护)。

OS X 10.11 has a so-called "rootless" feature, which forbidden users to modify /usr directory. OS X 10.11具有所谓的“无根”功能,禁止用户修改/usr目录。 The only exception is /usr/local . 唯一的例外是/usr/local So sudo is useless here. 所以sudo在这里毫无用处。 I suggest using rbenv to install a new ruby installation somewhere else. 我建议使用rbenv在其他地方安装新的ruby安装。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM