简体   繁体   中英

Adding gems on Sierra OS

I've tried to update, as well as run existing Ruby gems after upgrading to OS X Sierra.

> 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. Running the command with sudo also returns an error saying I lack permissions.

I tried 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:

    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. I usually avoid the default ruby that comes shipped with 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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