我尝试更新,并在升级到OS X Sierra后运行现有的Ruby宝石。
> sudo gem update --system
> Password: *enters password*
> Updating rubygems-update...
> ERROR: While executing gem ... (Errno::EPERM)
> Operation not permitted - /usr/bin/update_rubygems
无论是直接从RubyGems执行还是克隆并从Github下拉,都会发生这种情况。使用sudo运行命令也会返回错误,说我缺少权限。
我尝试了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>'
我刚刚执行了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
答案 0 :(得分:1)
也许安装rvm是最好的选择。我通常会避免使用OS X附带的默认ruby。
据说,我认为Sierra提供了需要禁用的新安全性,您可以在此处阅读:Disable Mac OS SIP