How to fix MySQL Workbench 8 for Mac
MySQL Workbench 8 contains a bug that prevents it from starting on Macs. Don’t worry: it’s easy to fix!
If you try to launch MySQL Workbench on a newly installed Mac or if you have recently upgraded your Python installation, there’s a decent chance that MySQL Workbench won’t be able to start:
If you try to start MySQL Workbench via the command line with the --verbose flag, you can see why it doesn’t work:
$ "/Applications/MySQLWorkbench.app/Contents/MacOS/MySQLWorkbench" --verboseFatal 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 0x0000000110e8ae00 (most recent call first):[1] 5814 abort "/Applications/MySQLWorkbench.app/Contents/MacOS/MySQLWorkbench" --verboseThe message shows that MySQL Workbench uses Python 3.7. First make sure this version is available on your machine. You easily do this by running the following Homebrew command:
$ brew install python@3.7Python should have been installed to /usr/local/Cellar/python@3.7/:
$ ls /usr/local/Cellar/python@3.7/3.7.10_2Make note of the version number, because you’ll need it later.
The message says that MySQL Workbench expects to find the Python framework at /Library/Frameworks/Python.framework, which doesn’t exist. You can verify this by executing the following command:
$ ls /Library/Frameworks/Python.frameworkls: /Library/Frameworks/Python.framework: No such file or directoryCreate a symlink at /Library/Frameworks/Python.framework that points to the real location of your Python.framework.
In my case, the version number was 3.7.10_2. The version number on your machine may be different. You can create the symlink as follows:
$ sudo ln -fs /usr/local/Cellar/python@3.7/3.7.10_2/Frameworks/Python.framework /Library/Frameworks/Python.frameworkMake sure to replace 3.7.10_2 with the version that is installed on your machine.
If you followed these steps, you should be able to start MySQL Workbench now. Happy databasing!