brew update error: Your local changes to the following files would be overwritten by merge

brew update error: Your local changes to the following files would be overwritten by merge

今天更新mac os 10.11.1 ,然后顺便更新了 xcode

然后我用 brew 安装 autoconf和automake

➜  /Users/zhangzhi  >brew install autoconf automake

然后报错


==> Downloading https://github.com/facebook/watchman/archive/v2.9.3.tar.gzAlready downloaded: /Library/Caches/Homebrew/watchman-2.9.3.tar.gz==> ./autogen.sh==> ./configure --prefix=/usr/local/Cellar/watchman/2.9.3 --with-pcrechecking for gcc… clangchecking whether the C compiler works… noconfigure: error: in /private/tmp/watchman-Ww0t/watchman-2.9.3': configure: error: C compiler cannot create executables Seeconfig.log’ for more detailsError: Homebrew doesn’t know what compiler versions ship with your versionof Xcode (7.1). Please brew update and if that doesn’t help, filean issue with the output of brew --config:https://github.com/Homebrew/homebrew/issues

Note that we only track stable, released versions of Xcode.

Thanks!

READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting


于是打算升级 brew

➜  /Users/zhangzhi  >brew update

接着出现了这样的错误


error: Your local changes to the following files would be overwritten by merge:Library/ENV/4.3/xcrunLibrary/brew.rbPlease, commit your changes or stash them before you can merge.AbortingError: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master➜ /Users/zhangzhi >brew doctorWarning: The /usr/local directory is not writable.Even if this directory was writable when you installed Homebrew, othersoftware may change permissions on this directory. Some versions of the“InstantOn” component of Airfoil are known to do this.

You should probably change the ownership and permissions of /usr/localback to your user account.

Warning: Ruby version 2.0.0 is unsupported.Homebrew is developed and tested on Ruby 1.8.x, and may not work correctlyon other Rubies. Patches are accepted as long as they don’t break on 1.8.x.Error: Homebrew doesn’t know what compiler versions ship with your versionof Xcode (7.1). Please brew update and if that doesn’t help, filean issue with the output of brew --config:https://github.com/Homebrew/homebrew/issues

Note that we only track stable, released versions of Xcode.

Thanks!


无法获取最新的代码,于是我开启 brew 诊断模式看看

➜  /Users/zhangzhi  >brew doctor

诊断信息如下:


Warning: The /usr/local directory is not writable.Even if this directory was writable when you installed Homebrew, othersoftware may change permissions on this directory. Some versions of the“InstantOn” component of Airfoil are known to do this.

You should probably change the ownership and permissions of /usr/localback to your user account.

Warning: Ruby version 2.0.0 is unsupported.Homebrew is developed and tested on Ruby 1.8.x, and may not work correctlyon other Rubies. Patches are accepted as long as they don’t break on 1.8.x.Error: Homebrew doesn’t know what compiler versions ship with your versionof Xcode (7.1). Please brew update and if that doesn’t help, filean issue with the output of brew --config:https://github.com/Homebrew/homebrew/issues

Note that we only track stable, released versions of Xcode.

Thanks!


第一个问题:The /usr/local directory is not writable.

/usr/local 目录竟然没有写的权限

我们需要 sudo 权限下给 /usr/local 目录改变权限

sudo chown -R $USER /usr/local

运行后, /usr/local 已经有了读写权限

第二个问题,拉取最新的 brew 代码

按照从上到下步骤依次运行

    1. cd brew --prefix
    1. git remote add origin https://github.com/mxcl/homebrew.git
      
    1. git fetch origin
      
    1. git reset --hard origin/master
      

上面步骤依次执行完以后,再去更新 brew update

➜  /usr/local git:(master) >brew update

最后结果:


➜  /usr/local git:(master) >brew update
Already up-to-date.

提示你更新完成

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值