You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

M1芯片设备Homebrew手动安装失败求助

解决Homebrew安装时Git拉取失败的问题

问题现象

执行安装命令 bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 后出现以下错误:

==> Checking for sudo access (which may request your password)...
Password:
==> This script will install:
/opt/homebrew/bin/brew
/opt/homebrew/share/doc/homebrew
/opt/homebrew/share/man/man1/brew.1
/opt/homebrew/share/zsh/site-functions/_brew
/opt/homebrew/etc/bash_completion.d/brew
/opt/homebrew

Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /usr/sbin/chown -R ruby:admin /opt/homebrew
==> Downloading and installing Homebrew...
HEAD is now at 344d32bf7 Merge pull request #14368 from Kentzo/fix-cask-backup
error: 2535 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
Error: Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-core failed!
Failed during: /opt/homebrew/bin/brew update --force --quiet

已更新Xcode并重新尝试,问题依旧。

解决步骤

  • 清理已安装的残留文件:
    sudo rm -rf /opt/homebrew
    
  • 临时调整Git参数,避免拉取大文件时中断:
    git config --global http.postBuffer 524288000
    git config --global core.compression 0
    
  • 重新运行Homebrew安装脚本:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
    
  • 若仍失败,手动克隆homebrew-core仓库:
    1. 创建Taps目录并设置权限:
      sudo mkdir -p /opt/homebrew/Library/Taps/homebrew
      sudo chown -R $(whoami):admin /opt/homebrew
      
    2. 克隆仓库:
      git clone https://github.com/Homebrew/homebrew-core.git /opt/homebrew/Library/Taps/homebrew/homebrew-core
      
    3. 执行更新:
      brew update --force --quiet
      

内容的提问来源于stack exchange,提问作者Audrey Nzilani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 20:31:05