MacPortsでとあるプログラムをインストールしようとしたところ、以下のエラーになった。インストールしてあるMacPortsが古い模様。

Error: Current platform "darwin 24" does not match expected platform "darwin 20" Error: If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration OS platform mismatch while executing "mportinit ui_options global_options global_variations" Error: /opt/local/bin/port: Failed to initialize MacPorts, OS platform mismatch

Migration – MacPortsを参考にして、

sudo port migrate

とすると、結局、上記のエラーになってしまう。そもそもportコマンド自体が上記エラーで動かないんだからあたり前ではある。

このため、関連ファイルを削除して、インストーラーを使って再インストールした。

sudo rm -rf /opt/local
sudo rm -rf /Applications/MacPorts
sudo rm -rf /Library/LaunchDaemons/org.macports.*
sudo rm -rf /Library/Receipts/MacPorts*.pkg
sudo rm -rf /Library/Receipts/MacPorts*.bom
sudo rm -rf /Library/StartupItems/MacPorts

Homebrewで事足りることが多くportは長期間使っていなかったんだな。