Apparently it's time for M1 users, to migrate their Homebrew config. Like right now.
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:
- Run
brew bundle dump
- this will create aBrewfile
in the current directory. - May or may not be necessary: Quit & relaunch Terminal, without Rosetta.
- Install Homebrew - let it go to the new dir,
/opt/homebrew/
- AKA${HOMEBREW_PREFIX}
. - Run
brew dump
- which uses the previously-createdBrewfile
, to (hopefully) install what you were using (as much as it can) in it’s new structure, in${HOMEBREW_PREFIX}
. - As long as this succeeded, delete / archive the
Brewfile
. If not, debug… - If you haven’t personalized
$PATH
etc.: Follow the directions (in the output above) for updating that. - 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). - Update any needed configs that live in
/usr/local
(ex: forclamav
), into the correct place in the new${HOMEBREW_PREFIX}
. - 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.) - Repeat on any other systems you need to.
- Set a reminder to clean out the stuff in
/usr/local
, once it’s no longer needed. (It might be sufficient towhich
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.