macOSにインストールしたMySQLWorkbench 8.0.23が起動しない。
コマンドラインで実行すると以下のエラーメッセージが出力されていた。
❯ /Applications/MySQLWorkbench.app/Contents/MacOS/MySQLWorkbench
Fatal Python error: initfsencoding: unable to load the file system codec, sys.path = ['/Applications/MySQLWorkbench.app/Contents/Resources/libraries', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload']
ModuleNotFoundError: No module named 'encodings'
Current thread 0x0000000107ee8dc0 (most recent call first):
Abort trap: 6
エラーメッセージを見ると、Python3.7が見つからないようだ。
対処法は以下の通り。
(1)Python3.7をインストールする。
brew install python@3.7
(2)シンボリックリンクを作成する。
sudo ln -s /usr/local/Cellar/python@3.7/3.7.10_2/Frameworks/Python.framework /Library/Frameworks/Python.framework
以上で、MySQLWorkbenchが起動するようになった。
参考
* MySQL Bugs: #102364: MySQL Workbench 8.0.23 unable to start due to wrong system python paths
* python – How to add a path to the system path in MySQL Workbench for Mac (Big Sur) – Stack Overflow