brew升級後ruby報錯怎麼辦?
wb670@zh-CN /System/Library/Frameworks/Ruby.framework/Versions/current cd ~
wb670@zh-CN ~ brew
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require": cannot load such file -- mach (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require"
from /usr/local/Library/Homebrew/extend/pathname.rb:2:in `&"
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require"
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require"
from /usr/local/Library/Homebrew/global.rb:3:in `&"
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require"
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require"
from /usr/local/Library/brew.rb:15:in `&"
看了一下/System/Library/Frameworks/Ruby.framework/Versions/2.0/這個目錄下我根本沒有usr
求助該問題怎麼解決 brew 裡面是這麼寫的1 #!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -W0
我是通過這種方式解決的
cd /usr/local git fetch git reset --hard origin/master
osx - Cannot update brew in MAC OS X el capitan and keep getting a Load error with `require`
卸載
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
從新安裝
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
謝邀。可能是許可權的問題既然無法解決就用 git reset 將所有文件設置為已修改,文件都在 /usr/local 下,把沒被 tracked 過的刪掉,然後恢復所有被 tracked 過的...如果還有問題應該就是 /usr/local 目錄許可權相關了。大概:
cd /usr/local
git reset --hard FETCH_HEAD
git clean -df
brew update
如果 brew update 提示 git pull 失敗提示 「failed while git pull」之類,試試用 git checkout Library 替換新文件:
cd /usr/local/git
git checkout Library
然後再 brew update,如果 terminal 里的提示信息是「Operation not permitted」,用 shown 指定一下 /usr/local 的目錄和組:
sudo shown -R rainy /usr/local //rainy 換成你的用戶名
推薦閱讀:
※關於完全聽不懂 Ruby 元編程在說什麼的事(零)
※主流程序設計語言的標準庫中,類似於 fopen() 之類的函數的 "w"、"a" 等控制方法有何利弊?
※2015 年的今天,Ruby on Rails 還有哪些獨特的價值?
※Ruby 和 Ruby on Rails 在 2017 年還有前途嗎?