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

来源:互联网 发布:借壳上市 知乎 编辑:程序博客网 时间:2024/05/14 10:58

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

然后报错


==> Downloadinghttps://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). Pleasebrew 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). Pleasebrew 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). Pleasebrew 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 updateAlready up-to-date.

提示你更新完成

阅读全文
0 0
原创粉丝点击