OsX, can't use Homebrew because of Ruby permis

2019-07-29 10:40发布

I have seen many related questions and posts, but I just can't fix my problems. I am running El Capitan and I want to have Homebrew and Ruby running. But if I want to run Homebrew I get permission errors like:

bio89093:~ jonbra$ brew doctor
/Library/Ruby/Site/2.0.0/rubygems.rb:1219:in `register_default_spec': undefined method `default_gems_use_full_paths?' for Gem:Module (NoMethodError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:699:in `block in load_defaults'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:647:in `block (2 levels) in each_spec'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:643:in `each'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:643:in `block in each_spec'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:642:in `each'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:642:in `each_spec'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:653:in `each_default'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:698:in `load_defaults'
    from /Library/Ruby/Site/2.0.0/rubygems.rb:1361:in `<top (required)>'
    from <internal:gem_prelude>:1:in `require'
    from <internal:gem_prelude>:1:in `<compiled>'

I have tried installing a separate version of Ruby using RVM, but it seems to require Homebrew...

3条回答
不美不萌又怎样
2楼-- · 2019-07-29 10:41

I had a similar issue. Try this in your terminal:

cd "$(brew --repo)" && git fetch && git reset --hard origin/master && brew update

They have a note at the top of the brew github page and following those instructions resolved my issue.

查看更多
Rolldiameter
3楼-- · 2019-07-29 10:44

Try removing and installing homebrew again:

to uninstall:

$ cd `brew --prefix`
$ rm -rf Cellar
$ brew prune
$ rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew
$ rm -rf ~/Library/Caches/Homebrew

and then:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
查看更多
Animai°情兽
4楼-- · 2019-07-29 10:59

Make sure that below folder contains no extra files and folders,

/Library/Ruby/Site/2.0.0

To do so, Please run,

$cd /Library/Ruby/Site/2.0.0
$rm -rf /Library/Ruby/Site/2.0.0/*
$/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Sometime you might get SSL error, in that case add -k option in curl.

$/usr/bin/ruby -e "$(curl -k -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
查看更多
登录 后发表回答