Drat; that was an unpleasant surprise:

For some reason, when I tried brew upgrade today, the response was: Cannot install in Homebrew on ARM processor in Intel default prefix.

Weird; it’s been working fine, via Terminal in Rosetta, on my M1, for quite some time. Last I saw, that was required, on Apple Silicon.

I don’t see any warning logged from past “brew update” runs. And I couldn’t find any announcement or release note, that Homebrew is now ready for prime-time on M1 - but apparently someone felt it necessary to force the issue. :/

So, since I depend on brew and several tools installed that way - including some automation - I dropped what I was supposed to be doing, to sort this out. Here’s what it took for me:

  1. Run brew bundle dump - this will create a Brewfile in the current directory.
  2. May or may not be necessary: Quit & relaunch Terminal, without Rosetta.
  3. Install Homebrew - let it go to the new dir, /opt/homebrew/ - AKA ${HOMEBREW_PREFIX}.
  4. Run brew dump - which uses the previously-created Brewfile, to (hopefully) install what you were using (as much as it can) in it’s new structure, in ${HOMEBREW_PREFIX}.
  5. As long as this succeeded, delete / archive the Brewfile. If not, debug…
  6. If you haven’t personalized $PATH etc.: Follow the directions (in the output above) for updating that.
  7. If you have (personalized $PATH etc.): Update that to also include ${HOMEBREW_PREFIX} (using the ouput as a guide) - note that there are some new environment vairables here, to consider adding to your shell’s config. You’ll likely want to make sure the new dir is before the old one (so any tools not yet updated are still accessible - and new tools take precedence over the now stranded ones).
  8. Update any needed configs that live in /usr/local (ex: for clamav), into the correct place in the new ${HOMEBREW_PREFIX}.
  9. Now find wherever you might have references to brew tools, which are hard-coded for /usr/local, and update instead, to ${HOMEBREW_PREFIX}. Suggestions of places to look: /etc/crontab, user-specific crontabs (ex: crontab -l), LaunchItems and such. And scripts that might be hard-coded for /usr/local. (Yes; hard-coding is “bad” - and sometimes useful to, for example, be sure to use the tool installed via brew, vs. a built-in tool by the same name.)
  10. Repeat on any other systems you need to.
  11. Set a reminder to clean out the stuff in /usr/local, once it’s no longer needed. (It might be sufficient to which each tool, and confirm when they’re all found in ${HOMEBREW_PREFIX} vs. the old /usr/local.)

Whew! That seemed a bit more difficult than necessary - especially since it was (as far as I could tell) forced without warning.