最近一次Mac升级, 导致使用brew出错,以后得记住升级之前最好用TimeMachine备份一下,不然折腾死人啊出错信息
/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>'
其实我没看懂出错信息(o)/~,反正就是brew也不能用了,然后就简单粗暴的来了比较好的升级方法可以参考这里池建强的文章
大致步骤
1.删除旧的brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
2.安装新的brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3.删除通过dmg文件安装的python3版本
系统python路径
/System/Library/Frameworks/Python.framework/Versions/
手动安装python路径
/Library/Frameworks/Python.framework/Versions/
(1)删除Python框架,参考
sudo rm -rf /Library/Frameworks/Python.framework/Versions/x.x
(2)删除Python程序
sudo rm -rf “/Applications/Python x.x”
(3)删除/usr/local/bin目录下的Python连接
3.用homebrew安装python3不同版本
brew install python3
网友评论