Intel 版 Mac から Apple Silicon 版 Mac へ移行アシスタントで環境を移行したあとも, Homebrew は Intel 版で問題なく稼働する.
ただし,アップグレードができない. そのため,ARM 版の Homebrew にマイグレードする.
% brew upgrade
すると
Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
と表示され,やはり そのまま Intel版の Homebrew をアップデートできない.
% brew bundle dump
上記コマンドで現在のインストールリストを ~/Brewfile にダンプ
Homebrew のホームページに書かれているインストール手順に従って ARM 版の Homebrew を インストール. (インストール場所は /opt/homebrew 配下となる)
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
以下のコマンドでコマンド検索 PATH を調整.
% echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/username/.zprofile % echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/username/.zprofile % eval "$(/opt/homebrew/bin/brew shellenv)"
ダンプしたリストから各 brew パッケージをインストール
% brew bundle ==> Tapping homebrew/bundle Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-bundle'... remote: Enumerating objects: 6858, done. ... Using homebrew/core Installing python@3.10 ... Homebrew Bundle complete! 19 Brewfile dependencies now installed.