繁体   English   中英

如何修复损坏的系统 Ruby 安装

[英]How to fix a broken System Ruby installation

我的Mac系统Ruby安装彻底坏了。

我看过几篇推荐我设置 RVM 或 rbenv 的帖子,但我正在尝试安装 Xcode 吊舱(cocoapods),我不知道为什么我的系统 Ruby 如此损坏。

当我运行gem时,我得到以下 output:

NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /Library/Ruby/Gems/2.3.0/specifications/coffee-script-source-1.11.1.gemspec:16.
NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /Library/Ruby/Gems/2.3.0/specifications/em-websocket-0.5.1.gemspec:15.
NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /Library/Ruby/Gems/2.3.0/specifications/escape-0.0.4.gemspec:18.
NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /Library/Ruby/Gems/2.3.0/specifications/fuzzy_match-2.0.4.gemspec:17.
NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /Library/Ruby/Gems/2.3.0/specifications/i18n-0.9.5.gemspec:17.
NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0/specifications/nokogiri-1.5.6.gemspec:22.
NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /Library/Ruby/Gems/2.3.0/specifications/rouge-2.2.1.gemspec:18.
NOTE: Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
Gem::Specification#rubyforge_project= called from /Library/Ruby/Gems/2.3.0/specifications/sass-3.7.4.gemspec:21.
RubyGems is a sophisticated package manager for Ruby.  This is a
basic help message containing pointers to more information.

似乎这些只是弃用警告,并且从其他一些帖子中,答案是简单地运行gem pristine --all --no-extensions

当我基本上运行任何gem命令时,我得到一个权限错误:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0 directory.

如何重置我的系统 Ruby? 我不使用 Ruby 并且我昨天运行了命令gem install cocoapods 从那以后它就无法使用了。

请注意,基本上您应该使用 rbenv 之类的工具自己安装rbenv ,但是如果您不想这样做,请参考下面的答案。


系统 Ruby 安装为root ,因此您需要sudo命令与之交互。 尝试sudo gem install cocoapods

(顺便说一句,没有子命令的gem命令只显示用法,没有损坏

暂无
暂无

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

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