I managed to move brew and php from an M1 silicon to an Intel Mac.

The php is broken due to different processors. And I would resolve that by installing a new php version with brew. This isn't about PHP, but about fixing my homebrew setup so I can return to the main act.

I'm thinking the Brew installation script is broken because it can't find git or can't realize I want to start freshly.

The install script when I run it ends in

Press RETURN/ENTER to continue or any other key to abort:
==> /usr/bin/sudo /usr/sbin/chown -R mattiaswelander:admin /usr/local/Homebrew
Unexpected Git version: ''!
You must install Git before installing Homebrew. See:

I have git, as git --version reveals:

mattiaswelander@a ~ % git --version
git version 2.39.2 (Apple Git-143)

I even tried downgrading to the git binary suggested by https://git-scm.com/downloads

mattiaswelander@a ~ % git --version
git version 2.15.0

but brew still can't find git, same error about version ''!

Running mattiaswelander@a ~ % which -a git

Reveals that I now have 3 sets of git installed:


And it seems that homebrew tries to use the version it thinks is installed using homebrew (the /opt/homebrew/bin/git version) but apparently that one doesn't work.

Potentially because it was built for a silicon chipset and it has now been unintentionally moved to an Intel machine (using the mac moving assistant).

How can I remove this from brew?

None of the suggested methods for uninstalling brew (like here https://osxdaily.com/2018/08/12/how-uninstall-homebrew-mac/) work, since they all require git...

----------- UPDATE -------------

By removing the /opt/homebrew/bin/git file, homebrew is no longer broken due to the lack of git. It is however broken due to this:

Error: Cannot install on Intel processor in ARM default prefix (/opt/homebrew)!

Is there a way to manually change that prefix to tell it what architecture it should install/self-update for?

The uninstall-scripts as suggested below don't work (because I'm on Ventura?)

  • 2
    I would suggest uninstalling homebrew and then reinstalling it and your packages: mac.install.guide/homebrew/5.html
    – JRFerguson
    Commented May 1, 2023 at 14:43
  • It’s the order of the directories in PATH that dictate which one comes first. That said, I wouldn’t move binaries from one platform to another (Silicon to Intel). Do clean installs to ensure proper installation
    – Allan
    Commented May 1, 2023 at 14:45
  • Allan's advice is solid, but I'm trying to help this OP without needing an erase install. I am pretty sure we can massage the path and remove all the various git - sadly that installation may have complicated things even further - the yak shaving continues - fix git (delete it or hide it in PATH), fix brew (delete it or pick apart which git is needed or trigger a good git install), etc...
    – bmike
    Commented May 1, 2023 at 14:56
  • Yes Allan, in retrospect that would have been the best =D But I didn't think that far before taking apple up on the offer of moving my files over automatically =( JRFerguson the uninstall command doesn't work with Ventura, I get mattiaswelander@a bin % /bin/bash -c "$(curl -fsSL raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" /bin/bash: line 250: /usr/local/bin/brew: No such file or directory Failed to locate Homebrew!
    – user59971
    Commented May 1, 2023 at 14:56
  • 1
    @JRFerguson That is a right and proper answer and if it weren't a comment we could elaborate on what will surely be errors in path since this is an uninstall on the wrong architecture...
    – bmike
    Commented May 1, 2023 at 14:56

1 Answer 1


I suggest uninstalling homebrew and then reinstalling it and your packages following this guide.

Although this would seem to be more tedious than fixing the PATH to git, a clean uninstall/reinstall is guaranteed to end with a sound build.

You currently have a homebrew installation that was built on a different architecture from where it sits. The issues begins with the PATH order as noted by @Allan and @bmike.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .