尝试安装gem,/ Library / Ruby / Gems / .0.0.0目录时没有写权限。已安装RVM

时间:2017-05-12 17:35:35

标签: ruby rubygems

非常乐意帮助我们学习如何处理所有这些宝石,并在安装“gem install x”时遇到问题。我到处都读到使用'sudo'不是最好的做法。

-facts -

gem install cucumber返回'You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.'

哪个宝石返回/usr/bin/gem

gem env返回

RubyGems Environment:
  - RUBYGEMS VERSION: 2.0.14.1
  - 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/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-16
  - GEM PATHS:
     - /Library/Ruby/Gems/2.0.0
     - /Users/username/.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
     - "gem" => "--no-ri --no-rdoc"
  - REMOTE SOURCES:
     - https://rubygems.org/

我安装了rvm但返回 -

No rvm rubies installed yet. Try 'rvm help install'

不确定该怎么做,会很感激帮助。

1 个答案:

答案 0 :(得分:0)

您需要root / administrator权限才能写入/及其子目录。你不能在不使用sudo或su的情况下安装任何东西。您的问题或类似问题已在此处得到解答:Installing gem or updating RubyGems fails with permissions error