mac brew update 报错
环境为mac, 总共报了三种错误。
对应三种不同的解法。
1. 第一种如下, 提示 1.8 的版本找不到
$ brew update
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line : /usr/local/Library/brew.rb: Undefined error:
这种比较简单。 原因是mac 升级到 某一个版本之后, ruby版本升级到2.0 了, 但是 brew.rb 中的版本号是 写死了1.8 , 需要修改下。
先检查一下自己 ruby版本 $ cd /System/Library/Frameworks/Ruby.framework/Versions/
一般来说, 都是 2.0
之后 $ vi /usr/local/Library/brew.rb 将第一行的 1.8 , 修改成 2.0 即可。
详细见: http://stackoverflow.com/questions/24225959/how-to-get-ruby-homebrew-rvm-to-work-on-yosemite
2. 第二种情况, 错误提示如下。
$ brew update
/Library/Ruby/Site/2.0./rubygems/ext/builder.rb::in `run': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError) /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for sys/select.h... yes
checking for poll.h... yes
checking for sys/epoll.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for port.h... no
checking for sys/resource.h... yes
creating Makefile make "DESTDIR=" clean make "DESTDIR="
compiling monitor.c
In file included from monitor.c::
In file included from ./nio4r.h::
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0./ruby/backward/rubyio.h::: warning: use "ruby/io.h" instead of "rubyio.h" [-W#warnings]
#warning use "ruby/io.h" instead of "rubyio.h"
^
warning generated.
In file included from monitor.c::
In file included from ./nio4r.h::
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0./ruby/backward/rubyio.h::: warning: use "ruby/io.h" instead of "rubyio.h" [-W#warnings]
#warning use "ruby/io.h" instead of "rubyio.h"
^
warning generated.
compiling nio4r_ext.c
In file included from nio4r_ext.c::
In file included from ./nio4r.h::
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0./ruby/backward/rubyio.h::: warning: use "ruby/io.h" instead of "rubyio.h" [-W#warnings]
#warning use "ruby/io.h" instead of "rubyio.h"
^
In file included from nio4r_ext.c::
./../libev/ev.c::: warning: '/*' within block comment [-Wcomment]
/*#define MIN_INTERVAL 0.00000095367431640625 /* 1/2**20, good till 2200 */
^
./../libev/ev.c::: error: '_Noreturn' keyword must precede function declarator
ecb_inline void ecb_unreachable (void) ecb_noreturn;
^~~~~~~~~~~~
_Noreturn
./../libev/ev.c::: note: expanded from macro 'ecb_noreturn'
#define ecb_noreturn _Noreturn
^
./../libev/ev.c::: warning: 'extern' variable has an initializer [-Wextern-initializer]
EV_API_DECL struct ev_loop *ev_default_loop_ptr = ; /* needs to be initialised to make it a definition despite extern */
make failed, exit code 2
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nio4r-1.0.0 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-16/2.0.0/nio4r-1.0.0/gem_make.out
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:51:in `block in make'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:43:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:43:in `make'
from /Library/Ruby/Site/2.0.0/rubygems/ext/ext_conf_builder.rb:43:in `block in build'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tempfile.rb:324:in `open'
from /Library/Ruby/Site/2.0.0/rubygems/ext/ext_conf_builder.rb:17:in `build'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:161:in `block (2 levels) in build_extension'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:160:in `chdir'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:160:in `block in build_extension'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:159:in `synchronize'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:159:in `build_extension'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/ext/builder.rb:195:in `build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1436:in `block in build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/user_interaction.rb:45:in `use_ui'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1434:in `build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/stub_specification.rb:60:in `build_extensions'
from /Library/Ruby/Site/2.0.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in `find'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:924:in `find_inactive_by_path'
from /Library/Ruby/Site/2.0.0/rubygems.rb:185:in `try_activate'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from /usr/local/Library/Homebrew/extend/pathname.rb:2:in `<top (required)>'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/Homebrew/global.rb:3:in `<top (required)>'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Library/brew.rb:17:in `<main>'
这种情况, 需要升级 gem 的版本。
一般来说是用 $ sudo gem update --system 来进行升级, 但是会报错。
$ sudo gem update --system
Password:
Sorry, try again.
Password:
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Not Found (http://ruby.taobao.org/specs.4.8.gz)
这种错误, 因为 gem源换了, 貌似原来的淘宝源不维护了。 具体见: https://ruby.taobao.org/ 。 需要跟换一下gem源
$ sudo gem update --system
Password:
Updating rubygems-update
Fetching: rubygems-update-2.6..gem (%)
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/update_rubygems
这种错误也没明白, 提示是 没有操作权限。 在网上查了一个方法, 修改命令成如下方式就可以了。
$ sudo gem update -n /usr/local/bin --system
执行完成之后, gem -v 可以看到 版本更新了。
这样, 第二个 gem update的错误,就快要解决了。
第三个问题, 继续 brew update, 出现如下错误。
$ brew update
/Library/Ruby/Site/2.0./rubygems/core_ext/kernel_require.rb::in `require': cannot load such file -- mach (LoadError)
from /Library/Ruby/Site/2.0./rubygems/core_ext/kernel_require.rb::in `require'
from /usr/local/Library/Homebrew/extend/pathname.rb::in `<top (required)>'
from /Library/Ruby/Site/2.0./rubygems/core_ext/kernel_require.rb::in `require'
from /Library/Ruby/Site/2.0./rubygems/core_ext/kernel_require.rb::in `require'
from /usr/local/Library/Homebrew/global.rb::in `<top (required)>'
from /Library/Ruby/Site/2.0./rubygems/core_ext/kernel_require.rb::in `require'
from /Library/Ruby/Site/2.0./rubygems/core_ext/kernel_require.rb::in `require'
from /usr/local/Library/brew.rb::in `<main>'
根据 http://stackoverflow.com/questions/24652996/homebrew-not-working-on-osx 的最高票答案就可以解决。
$ sudo chown -R $(whoami):admin /usr/local
如果这个指令没有解决, 则采用下面的步骤。
1. open terminal
2. $ cd /usr/local/Homebrew , 这里的路径我是: /usr/local/Library/
3. $ git reset --hard
4. $ git clean -df
5. $ brew update
至此, 这个问题解决了。
mac brew update 报错的更多相关文章
- mac下brew install 报错
mac下brew install 报错 错误提示: 原因:是这个brew的权限不正确 修改一下这个brew的权限 chown root:wheel /usr/local/bin/brew
- Mac 下使用brew install 报错: Cowardly refusing to `sudo brew install'
Mac 下使用brew install 报错: localhost:infer-osx-v0.6.0 admin$ sudo brew install opam Error: Cowardly ref ...
- Mac安装MySQL-python报错解决
Mac安装MySQL-pyhton报错 今天在Mac上安装MySQL-python报错,搜遍网络都说什么mysql config路径问题,但是都不行. 解决方案 一开始遇到的问题是: Complete ...
- mysql执行update报错1175解决方法
mysql执行update报错 update library set status=true where 1=1 Error Code: 1175. You are using safe update ...
- mysql执行update报错 Err] 1055 - 'information_schema.PROFILING.SEQ' isn't in GROUP BY
mysql执行update报错 Err] 1055 - 'information_schema.PROFILING.SEQ' isn't in GROUP BY 今天开发的同事发来如下错误信息,最最简 ...
- kali linux 2.0配置更新源后apt-get update 报错
这个是我/etc/apt/sources.list的更新源: deb http://http.kali.org/kali kali-rolling main contrib non-free deb ...
- Mac Angular打包报错xcode-select: error: tool 'xcodebuild' requires Xcode
Mac Angular打包报错: Error: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer ...
- apt-get update 报错 W: Unknown Multi-Arch type 'no' for package 'compiz-core'
源 #deb包 deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse deb http:// ...
- Docker ubuntn 使用apt-get update报错
在docker 容器中执行apt-get update有时候会报错,当然造成错误的原因有很多情况,具体情况具体分析, APT Hash sum mismatch错误的常见解决方法总结这篇博客写的不错, ...
随机推荐
- plt 数据可视化
1.plt.plot(x,y,color) 折线坐标图 import matplotlib.pyplot as plt h = np.linspace(1, 10, 10) v = np.linspa ...
- 基于Jmeter和Testlink的自动化测试框架研究与实施
关于测试框架搭建的详细过程,会在另一篇文章中详细介绍:http://www.cnblogs.com/leeboke/p/6145977.html 摘 要 目前基于Jmeter的接口自动化测试框架,大多 ...
- Expo大作战(三十八)--expo sdk api之 FileSystem(文件操作系统)
简要:本系列文章讲会对expo进行全面的介绍,本人从2017年6月份接触expo以来,对expo的研究断断续续,一路走来将近10个月,废话不多说,接下来你看到内容,讲全部来与官网 我猜去全部机翻+个人 ...
- Appium学习——安装Android SDK
.下载Android SDK 下载地址:http://tools.android-studio.org/index.php/sdk 百度搜索Android SDK也可以. 下载之后,Android S ...
- Dos烧录脚本
Dos命令之前更改的太简单,现在加入判断是否进入fasboot模式和判断Android镜像是否存在:代码已经尽量简化成这样,dos命令功能还是比较不好用的,用了一下午的时间... @echo off ...
- Docker学习—Docker简介
什么是Docker Docker 是一个开源项目,诞生于 2013 年初,最初是 dotCloud 公司内部的一个业余项目.它基于 Google 公司推出的 Go 语言实现. 项目后来加入了 Linu ...
- C#项目实践之一——WPF多媒体通讯录
1.Window.Resources 是一种Window级的资源定义. Window.Resources它的作用范围就是在Window容器里的所有子控件,也只有这些子控件才能引用/调用这些资源 Gr ...
- windows下编写shell脚本执行错误
在 windows 下,换行符是 \r\n,在linux下,换行符是 \n.如果你在IDEA里写sh脚本,可以手动设置脚本的换行符为 \n,如果你用notepad++写脚本,可以显示所有字符,以便明确 ...
- 1.1开篇一:C语言编译器的选择---Dev C++
返回总目录 目录: 1.Dev C++的下载&安装: 2.Dev C++的使用: 前言: 那么多编译器,为什么选择Dev C++?理由有下 理由一:Dev C++ 体积比较小,不占用太多的内存 ...
- MATLAB数值积分法
MATLAB数值积分法 作者:凯鲁嘎吉 - 博客园http://www.cnblogs.com/kailugaji/ 一.实验目的 许多工程技术和数学研究中要用到定积分,如果无法直接算不出精确值(如含 ...