简体   繁体   中英

How to fix a broken System Ruby installation

My Mac system Ruby installation is completely broken.

I've seen several posts recommending me to set up RVM or rbenv but I'm trying to install an Xcode pod (cocoapods), and I have no idea why my system Ruby is so broken.

When I run gem , I get the following 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.

and it seems that these are just deprecation warnings, and, from some other posts, that the answer is to simply run gem pristine --all --no-extensions .

When I run essentially any gem command, I get a permissions error:

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.

How do I reset my system Ruby? I don't use Ruby and I had run the command gem install cocoapods yesterday. Since then it's been unusable.

Note that basically you should install Ruby by yourself with tools like rbenv , but if you don't want to do it, please refer to the answer below.


System Ruby is installed for root , so you need sudo command to interact with it. Try sudo gem install cocoapods .

(Btw, gem command with no sub commands just shows the usage, which is not broken )

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