简体   繁体   English

在Sierra OS上添加gem

[英]Adding gems on Sierra OS

I've tried to update, as well as run existing Ruby gems after upgrading to OS X Sierra. 在升级到OS X Sierra之后,我尝试更新并运行现有的Ruby gem。

> sudo gem update --system

> Password: *enters password*

> Updating rubygems-update...

> ERROR:  While executing gem ... (Errno::EPERM)

> Operation not permitted - /usr/bin/update_rubygems

This happens whether I execute directly from RubyGems or clone and pull down from Github. 无论我直接从RubyGems执行还是从Github克隆并退出,都会发生这种情况。 Running the command with sudo also returns an error saying I lack permissions. 使用sudo运行命令还会返回一条错误消息,提示我缺少权限。

I tried sudo rubygems_update : 我尝试了sudo rubygems_update

/usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/dependency.rb:308:in `to_specs': Could not find 'rubygems-update' (>= 0.a) among 7 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/Angelfirenze/.gem/ruby/2.4.0:/usr/local/lib/ruby/gems/2.4.0:/usr/local/Cellar/ruby/2.4.0/lib/ruby/gems/2.4.0', execute `gem env` for more information
    from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/dependency.rb:320:in `to_spec'
    from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
    from /usr/local/bin/update_rubygems:22:in `<main>'

I have just executed gem env and my terminal returned the following: 我刚刚执行了gem env ,我的终端返回了以下内容:

    RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.8
  - RUBY VERSION: 2.0.0 (2015-12-16 patchlevel 648) [universal.x86_64-darwin16]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - SPEC CACHE DIRECTORY: /Users/Angelfirenze/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-16
  - GEM PATHS:
     - /Library/Ruby/Gems/2.0.0
     - /Users/Angelfirenze/.gem/ruby/2.0.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/Angelfirenze/.rbenv/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /usr/local/git/bin
     - /usr/local/MacGPG2/bin
     - /Users/Angelfirenze/.rvm/bin
     - /Users/Angelfirenze/bin
     - /Users/Angelfirenze/bin

Maybe installing rvm would be the best option. 也许安装rvm是最好的选择。 I usually avoid the default ruby that comes shipped with OS X. 我通常避免使用OS X随附的默认红宝石。

With that said I think Sierra ships with new security that needs to be disabled you can read about it here: Disable Mac OS SIP 话虽如此,我认为Sierra具有需要禁用的新安全性,您可以在此处阅读有关内容: 禁用Mac OS SIP

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

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