【问题标题】:Brew Update not working after mac 10.9Brew 更新在 mac 10.9 之后无法正常工作
【发布时间】:2013-12-06 16:01:42
【问题描述】:

自 10.9 升级以来首次运行 brew。

从下面的输出中,我应该只删除 Library/Formula/ant.rb 和 Library/Formula/apple-gcc42.rb 吗?另外,不清楚为什么 git pull 失败了。感谢您的帮助

525    [projects]$  brew --config
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew.git
HEAD: 27c26faf7b958de6028ad55be8ccc5a57b094d3f
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit ivybridge
OS X: 10.9-x86_64
Xcode: 5.0.2
GCC-4.2: build 5666
LLVM-GCC: build 0
Clang: 5.0 build 500
X11: N/A
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/*****/.rvm/rubies/ruby-2.0.0-p195/bin/ruby
526    [projects]$  brew update
error: The following untracked working tree files would be overwritten by merge:
    Library/Formula/ant.rb
    Library/Formula/apple-gcc42.rb
Please move or remove them before you can merge.
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master

【问题讨论】:

    标签: homebrew


    【解决方案1】:

    我已经尝试了此处发布的所有解决方案,但没有任何效果。 我找到了解决 Homebrew 相关问题的解决方案,那就是“brew doctor”。此命令选项诊断问题并提出解决方案。就我而言,该命令显示以下注释。

    我猜这个命令可以解决很多与 home brew 相关的问题,所以试试吧!

    ❯ brew doctor
    Please note that these warnings are just used to help the Homebrew maintainers
    with debugging if you file an issue. If everything you use Homebrew for is
    working fine: please don't worry or file an issue; just ignore this. Thanks!
    
    Warning: A newer Command Line Tools release is available.
    Update them from Software Update in System Preferences or run:
      softwareupdate --all --install --force
    
    If that doesn't show you any updates, run:
      sudo rm -rf /Library/Developer/CommandLineTools
      sudo xcode-select --install
    
    Alternatively, manually download them from:
      https://developer.apple.com/download/all/.
    You should download the Command Line Tools for Xcode 13.1.
    

    【讨论】:

      【解决方案2】:

      在 Big Sur 11.4 上对我有用的是首先通过执行以下命令来关注 Pritam 评论:

      /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
      

      然后执行以下(国防部所说的,但有附加):

      git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow && git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
      

      这两个命令都需要一段时间才能完成,别担心不是你....让它们运行 ?

      【讨论】:

        【解决方案3】:

        在 Big Sur 11.1 上为我修复了它:

        git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

        Brew 自己将其描述为:

        brew update,首先运行: git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow 这个限制是在 GitHub 的请求上做出的,因为更新很浅 由于树的布局和流量,克隆是一项极其昂贵的操作 Homebrew/homebrew-core 和 Homebrew/homebrew-cask。我们不为你做这个 自动避免重复执行昂贵的非浅层操作 CI 系统(应该改为不使用浅克隆)。对于某事很抱歉 不便之处!

        【讨论】:

          【解决方案4】:

          对我有用的是像this这样更新brew:

          /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
          

          【讨论】:

            【解决方案5】:

            这为我解决了问题

            cd `brew --prefix`/Homebrew
            git fetch origin
            git reset --hard origin/master
            

            之后,brew 更新运行良好

            【讨论】:

            • 感谢您[正确而简洁地]回答您的问题。太多人不会像那样跟进。看好你! :)
            • 最后一个命令我必须使用sudo git reset --hard origin/master
            • 执行上述步骤后。当我进行酿造更新时。我有以下错误您可能应该将 /usr/local 的所有权和权限更改回您的用户帐户。 sudo chown -R $(whoami):admin /usr/local
            • 在执行时间机器迁移后为我工作
            • 出于某种原因,brew update 已经有一个多星期没有真正更新任何内容了。这解决了它。谢谢!
            【解决方案6】:

            我的 brew 更新挂起,什么也没做。我在 OSX 10.12.5 上,以上都不适合我,我在 usr/local 中没有 .git,只有在 usr/local/Homebrew 中。

            我运行了 brew update --debug --verbosebrew update 并解决了问题,请参阅此问题:https://github.com/Homebrew/brew/issues/895

            【讨论】:

              【解决方案7】:

              解决方案

              你可能仍然会找到..

              git pull origin master之后

              brew更新不工作

              这是你需要做的。

              cd /usr/local git pull origin master brew install git

              现在你可能已经在你的系统上安装了 git, 但是现在这会做什么。

              您损坏的 brew 更新将在首次运行之前自动更新..

              这里是 HomeBrew 中原始问题的链接。 brew stuck

              【讨论】:

              • 对我来说,我到了这一点,它最终给了我一个关于安装 2 个 xcode 版本的错误。我有一个额外的项目/facepalm 的遗留开发
              【解决方案8】:

              我只是删除了/usr/local 目录中的.git 目录,然后运行命令brew update

              【讨论】:

                【解决方案9】:

                我这样做是为了解决问题

                cd /usr/local
                git pull origin master
                

                【讨论】:

                  猜你喜欢
                  • 1970-01-01
                  • 2019-08-10
                  • 2014-05-29
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  相关资源
                  最近更新 更多