Skip to content

Installing a newer Homebrew.pkg over an existing installation corrupts the Git repository, so brew update fails #24701

Description

@tmoschou

brew doctor output

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: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:

  openssl@3.0

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built.

Run `brew link` on these:
  z3
  little-cms2
  helmfile
  harfbuzz
  lz4
  jpeg-turbo

Warning: Some installed formulae or casks are missing dependencies:
  ffmpeg: sdl3
  sdl2-compat: sdl3

You should `brew install` the missing dependencies:
  brew install --as-dependency sdl3

Verification

  • I ran brew update twice and am still able to reproduce my issue.
  • I have supplied my brew doctor output above and it seems unrelated to my issue.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.
  • I did not use AI/LLM to create this issue, or I disclosed the tool and model used; I will answer maintainer questions myself without AI/LLM.

brew config output

HOMEBREW_VERSION: 7.0.15
ORIGIN: https://github.com/Homebrew/brew
HEAD: 3e47189a707c739ee1278a28a3b845f5834574e6
Last commit: 26 hours ago
Branch: stable
Core tap: N/A
Core cask tap: N/A
HOMEBREW_PREFIX: /opt/homebrew
Homebrew Ruby: 4.0.10 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/4.0.10/bin/ruby
CPU: 18-core 64-bit arm_sotra
Clang: 21.0.0 build 2100
Git: 2.56.1 => /opt/homebrew/opt/git/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 26.7.3-arm64
CLT: 27.0.0.0.1788430756
Xcode: N/A
Rosetta 2: false

What were you trying to do (and why)?

We deploy Homebrew to developer Macs through an MDM/Jamf Self Service portal script that uses Installomator's homebrew.sh to automate the download/version checking etc.

The script, preinstalls MacOS Xcode Command Line Tools, and installs the latest Homebrew.pkg. and later installs newer releases of the pkg over the existing installation. Between pkg installs, users can run brew update as normal.

Our script will sets defaults write /var/tmp/.homebrew_pkg_user HOMEBREW_PKG_USER "$CURRENT_USER" prior to the installation to ensure that /opt/homebrew is owned by the non-admin login user.

We expect our jamf script and the homebrew installer to be idempotent / rerunable (Installomator only runs installer if there is a newer version)

What happened (include all command output)?

After the pkg was upgraded from 7.0.14 to 7.0.15 using installomator:

2026-11-20 11:57:56 : INFO  : homebrew : setting variable from argument LOGO="/private/tmp/<REDACTED>/libs/<REDACTED>.png"
2026-11-20 11:57:56 : INFO  : homebrew : setting variable from argument DEBUG=0
2026-11-20 11:57:56 : INFO  : homebrew : setting variable from argument NOTIFY=all
2026-11-20 11:57:56 : INFO  : homebrew : setting variable from argument BLOCKING_PROCESS_ACTION=tell_user
2026-11-20 11:57:56 : INFO  : homebrew : Total items in argumentsArray: 4
2026-11-20 11:57:56 : INFO  : homebrew : argumentsArray: LOGO="/private/tmp/<REDACTED>/libs/<REDACTED>.png" DEBUG=0 NOTIFY=all BLOCKING_PROCESS_ACTION=tell_user
2026-11-20 11:57:56 : REQ   : homebrew : ################## Start Installomator v. 10.10, date 2026-11-12
2026-11-20 11:57:56 : INFO  : homebrew : ################## Version: 10.10
2026-11-20 11:57:56 : INFO  : homebrew : ################## Date: 2026-11-12
2026-11-20 11:57:56 : INFO  : homebrew : ################## homebrew
2026-11-20 11:57:56 : INFO  : homebrew : SwiftDialog is not installed, clear cmd file var
2026-11-20 11:57:58 : INFO  : homebrew : Reading arguments again: LOGO="/private/tmp/<REDACTED>/libs/<REDACTED>.png" DEBUG=0 NOTIFY=all BLOCKING_PROCESS_ACTION=tell_user
2026-11-20 11:57:58 : INFO  : homebrew : BLOCKING_PROCESS_ACTION=tell_user
2026-11-20 11:57:58 : INFO  : homebrew : NOTIFY=all
2026-11-20 11:57:58 : INFO  : homebrew : LOGGING=INFO
2026-11-20 11:57:58 : INFO  : homebrew : LOGO=/private/tmp/<REDACTED>/libs/<REDACTED>.png
2026-11-20 11:57:58 : INFO  : homebrew : Label type: pkg
2026-11-20 11:57:58 : INFO  : homebrew : archiveName: Homebrew.pkg
2026-11-20 11:57:58 : INFO  : homebrew : no blocking processes defined, using Homebrew as default
2026-11-20 11:57:58 : INFO  : homebrew : found packageID sh.brew.homebrew installed, version 7.0.14
2026-11-20 11:57:58 : INFO  : homebrew : appversion: 7.0.14
2026-11-20 11:57:58 : INFO  : homebrew : Latest version of Homebrew is 7.0.15
2026-11-20 11:57:58 : REQ   : homebrew : Downloading https://github.com/Homebrew/brew/releases/download/7.0.15/Homebrew.pkg to Homebrew.pkg
2026-11-20 11:57:58 : INFO  : homebrew : notifying
displaynotification:7: no such file or directory: /usr/local/bin/dialog
2026-11-20 11:58:24 : INFO  : homebrew : Downloaded Homebrew.pkg – Type is  xar archive compressed TOC
2026-11-20 11:58:24 : INFO  : homebrew : - OpenPGP Public Key – SHA is 49675819d29edabb31e50324965cfa377a8cdcfc – Size is 164524 kB
2026-11-20 11:58:24 : REQ   : homebrew : no more blocking processes, continue with update
2026-11-20 11:58:24 : REQ   : homebrew : Installing Homebrew
2026-11-20 11:58:24 : INFO  : homebrew : notifying
displaynotification:7: no such file or directory: /usr/local/bin/dialog
2026-11-20 11:58:24 : INFO  : homebrew : Verifying: Homebrew.pkg
2026-11-20 11:58:24 : INFO  : homebrew : Team ID: 927JGANW46 (expected: 927JGANW46 )
2026-11-20 11:58:24 : INFO  : homebrew : Checking package version.
2026-11-20 11:58:25 : INFO  : homebrew : Downloaded package sh.brew.homebrew version 7.0.15
2026-11-20 11:58:25 : INFO  : homebrew : Installing Homebrew.pkg to /
2026-11-20 11:59:02 : INFO  : homebrew : Finishing...
2026-11-20 11:59:05 : INFO  : homebrew : found packageID sh.brew.homebrew installed, version 7.0.15
2026-11-20 11:59:05 : REQ   : homebrew : Installed Homebrew, version 7.0.15
2026-11-20 11:59:05 : INFO  : homebrew : notifying
displaynotification:7: no such file or directory: /usr/local/bin/dialog
2026-11-20 11:59:05 : INFO  : homebrew : Installomator did not close any apps, so no need to reopen any apps.
2026-11-20 11:59:05 : REQ   : homebrew : All done!
2026-11-20 11:59:05 : REQ   : homebrew : ################## End Installomator, exit code 0 

brew update fails:

==> Updating Homebrew...
fatal: You are attempting to fetch 19c51922b299aff856689bcb5aede7841e790f2b, which is in the commit graph file but not in the object database.
This is probably due to repo corruption.
If you are attempting to repair this repo corruption by refetching the missing object, use 'git fetch --refetch' with the missing object.
Error: Fetching /opt/homebrew failed!

brew update-reset runs the same git fetch --force --tags origin, and that fetch fails with the same error.

What Claude Opus 5.5 found:


  • The pkg installs .git as payload files, including its pack: pkgutil --files sh.brew.homebrew lists .git/objects/pack/pack-2e6828009afb….{idx,pack,rev} and about 650 other .git files.
  • During the 7.0.15 install, /var/log/install.log shows:
    installd: PackageKit: Will do receipt-based obsoleting for package identifier sh.brew.homebrew (prefix path=opt/homebrew)
    installd: PackageKit: Cannot obsolete expected directory (/opt/homebrew/.git/refs/remotes/origin/livecheck), opening the directory failed. No such file or directory
    The receipt-based obsoleting deleted the 7.0.14 pkg's pack (pack-aa265ea77cd9…), because 7.0.15 doesn't ship it.
  • Git wrote other metadata locally during brew update after the 7.0.14 install. None of it is in the pkg receipt, and it still refers to objects that only existed in the deleted pack:
    • objects/pack/multi-pack-index and objects/info/packs still list pack-aa265ea77cd9….
    • The commit-graph chain contains commits from that pack.
    • packed-refs has 13 refs/remotes/origin/* branches whose commits are in no remaining pack, e.g. cask-audit-skip-intel-signing → 19c5192….
  • The postinstall resets the working tree (checkout --force -B stable, reset --hard, clean -f -d), so the installation looks fine until the next fetch.

What did you expect to happen?

After installing a newer Homebrew.pkg over an existing installation, the repository still works and brew update succeeds. The postinstall's "reset Git repository" step suggests that installing over an existing installation is meant to work.

We expect our jamf script and the homebrew installer to be idempotent / rerunable safely, tolerate user driven brew updates, and additionally the post-install should update HEAD to latest, regardless when .pkg was tagged/released.

Step-by-step reproduction instructions (running brew commands)

I haven't reproduced this from a clean machine. These steps are reconstructed from the logs and repository state above:
1. Set the user the pkg installs Homebrew for, as our MDM does:
CURRENT_USER="$(id -un)"
sudo defaults write /var/tmp/.homebrew_pkg_user HOMEBREW_PKG_USER "$CURRENT_USER"
2. Install Homebrew.pkg 7.0.14: sudo installer -pkg Homebrew-7.0.14.pkg -target /
3. Run brew update (and run it again after upstream has moved on).
4. Install Homebrew.pkg 7.0.15 over it: sudo installer -pkg Homebrew-7.0.15.pkg -target /
5. Run brew update.

Activity

  1. added theissue type on Nov 20, 2026
  2. tmoschou commented on Nov 20, 2026

    @tmoschou
    Author

    Also note that running git fetch --refetch in /opt/homebrew as suggested by git also errors with

    remote: Enumerating objects: 375559, done.
    remote: Counting objects: 100% (1258/1258), done.
    remote: Compressing objects: 100% (356/356), done.
    remote: Total 375559 (delta 1082), reused 953 (delta 902), pack-reused 374301 (from 4)
    Receiving objects: 100% (375559/375559), 130.60 MiB | 11.11 MiB/s, done.
    Resolving deltas: 100% (266325/266325), done.
    fatal: bad object refs/remotes/origin/commands-hidden-text-check
    error: https://github.com/Homebrew/brew did not send all necessary objects
    
  3. self-assigned this
    on Nov 20, 2026
  4. added 10 commits that reference this issue on Nov 20, 2026
    4970562
    25f6da7
    4981095
    1bd00fb
    52b2ebb
    9c761fd
    bb6146e
    b083d8a
    a661818
    77ba11a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions