最近开了asp.NET的课,身为强迫症能不用win绝对不用!!!去年看巨硬发布会知道了年末开始测试Visual Studio for Mac Preview,所以开始折腾起来,安.net core的时候结果更新个brew都出问题,所以就把网上的方法记录下来和大家分享一下.
执行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 `<top (required)>'
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 `<top (required)>'
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 `<main>'
原因
El Capitan 以上的系统开启了SIP系统保护,文件权限丢失.
先解决权限
sudo chown -R $(whoami):admin /usr/local
重置homebrew目录,再更新
1. open terminal
2. $ cd /usr/local
3. $ git reset --hard
4. $ git clean -df
5. $ brew update
感谢:http://www.voidcn.com/blog/tmpbook/article/p-5765012.html