wine allows you to use
HeidiSQL on a macos machine.
From time to time I miss a Win32 or Win64 application on macos. Obviously we cannot simply run them out of the box on another operating system. For this we need Wine. It is an free open source tool that maps the commands from a Win32 or Win64 program to those available on the host machine. From a user perspective it feels much like an emulator so you can simply start a program without the need of recompiling or a virtual machine.
In this article I like to summarize the steps necessary to run Win32 or Win64 applications on macos using wine and how to integrate them nicely into your system.
As an example I take the incredible tool HeidiSQL.
Here are the things I personally love about it:
- Support for MySQL and MariaDB databases
- Many connection options and the ability to save credentials
- You can edit virtually every aspect of your database via UI
- Inspect and modify databases
- Create, modify, rename and delete tables using a clever UI
- High quality query editor
- Smart syntax highlight and context aware code completion
- Very useful UI tools like multi-column-order-sorting
- Export query results to CVS, JSON and friends
- Inspect all changes that were made in the sql query history
- Manage database users and their rights using dialogs
- Export and import databases or tables in many formats
- Many small but clever UI decisions that show a long history of excellent open source work.
- 100% open source, no strings attached.
- …and a lot more
I really like it and it’s too good to not have it.
To install wine and later HeidiSQL I suggest to use the following setup:
|homebrew||A macos package manger which helps installing terminal and UI programs. Similar to what we know and love in Linux with apt-get and friends.|
|xquartz||This is required for the UI level of the wine|
|wine||The API translation layer that allows macos to run Win32 or Win64 applications natively.|
|Script Editor of macos||It is part of macos and is already installed. We use this to generate a start script and let HeidiSQL look like a normal application|
Be careful. Programs like this might destabilize your operating system. Take your time to familiarize yourself with the software and the potential risks involved before installing it.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew cask install xquartz
brew install wine
Test if wine is working
wine # should print something like this: # Usage: wine PROGRAM [ARGUMENTS...] Run the specified program # wine --help Display this help and exit # wine --version Output version information and exit
That’s it! If your output looks like this it means wine should work. If you have any trouble check out David Baumgold’s great article about installing wine on macos.
Download and run HeidiSQL
With wine running we now can simply download HeidiSQL for Win32. To do that we simply go to the HeidiSQL download page. Here I recommend to download the
portable edition 32bit.
zip file to a folder in your user directory. For example:
To test if it works open your terminal navigate into the directory and start it like this:
cd ~/winapps/heidisql wine heidisql.exe
This should run the program and you should see the connection window:
If you use more than one monitor it can happen that the window doesn’t popup properly. If you cannot see this window don’t be alarmed. Search around a bit to find it. Also note that the first window does not show up in Mission Control.
Create an app container using the Script Editor
Now that we prepared our system to run the application let us create an application container for it. Open the application Script Edit on your mac. It should be shipped with your machine. Create a new script and copy the following line as an Apple Script:
set wine to "\"/usr/local/bin/wine\"" set applocation to "\"$HOME/winapps/heidisql/heidisql.exe\"" do shell script wine & " " & applocation & " > /dev/null 2>&1 &"
If you selected a different location make sure to adjust the script. Also ensure that wine can actually be found at
/usr/local/bin/wine. If it’s not at that place try to find it in the terminal using
Once you are sure all paths are correct hit the big play button. Now HeidiSQL should start. If that works we can close the app again and save the script. When the save dialog pops up make sure to select
program as export. Select a filename and save it in your application folder.
We are nearly done. The only thing that is left is the icon.
To fix that we first need to fetch an PNG image which we can use an icon. As time of writing you can find a nice HeidiSQL icon on Wikipedia. Open that file with a browser and copy it into your clipboard. If your browser doesn’t support that I recommend to try Firefox. Once you copied that image select
heidisql.app and right click on it to open the context menu. Select
Information and select the default icon. Press
CMD + V to replace it with the image from your clipboard.
That’s it! You now can use HeidiSQL on your mac.
Grain of salt
Even though wine is doing a great job in transferring the program into your macos experience in some details you still notice the difference. For example is the shortcut for copy text not
CMD + C but
CTRL + C. This can get crazy when switching between mac and wine programs. Sometimes HeidiSQL consumes all keyboard input and you need to hit
ESC to get it responding normal again. In rare cases, e.g. when importing large databases it tends to freeze and need to be restarted.
Some final words
HeidiSQL is a great tool and an excellent example on how you can actually work productive with wine powered programs. How is your experience with wine or HeidiSQL? Let me know what you think. firstname.lastname@example.org.