I wanted to run a Windows machine on my Mac OS X. So obvious choice was using WineHQ. Ideally, it should have been 1/ Download, 2/ Install and 3/ Run. However, it is never that simple, isn’t it!?
Configuration of iMac
macOS Catalina (10.15.1)
iMac (21.5-inch, Late 2102)
Steps for Running WineHQ on macOS Catalina
1. I wanted to use HomeBrew, so I ran this command from https://brew.sh/ and downloaded needed components
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" $ brew install bison flex mingw-w64 pkgconfig $ brew link bison --force $ brew install freetype
2. I updated ~/vi .bash_profile and added
$ vi ~/.bash_profile export PATH=/usr/local/Cellar/bison/3.5.3/bin:$PATH export DYLD_FALLBACK_LIBRARY_PATH=/usr/X11/lib:/usr/local/lib:/usr/local/libpng $ which bison /usr/local/Cellar/bison/3.5.3/bin/bison
3. I downloaded version 5.3 from https://dl.winehq.org/wine/source/5.x/
4. Seems like this is a known bug https://bugs.winehq.org/show_bug.cgi?id=48689 and the fix has been provided here: https://source.winehq.org/git/wine.git/blobdiff/76606eaea034c51a73190aac92e75d8b20e82164..35c223850e1bc9e8f97bfaf403bfabca69db3447:/dlls/ntdll/locale.c
5. Edited wine-5.3/dlls/ntdll/locale.c accordingly (though the line numbers did not match)
--- a/dlls/ntdll/locale.c +++ b/dlls/ntdll/locale.c @@ -799,13 +799,7 @@ void init_unix_codepage(void) #else /* __APPLE__ || __ANDROID__ */ -void init_unix_codepage(void) -{ -#ifdef __APPLE__ - const struct norm_table *info; - load_norm_table( NormalizationC, &info ); -#endif -} +void init_unix_codepage(void) { } #endif /* __APPLE__ || __ANDROID__ */ @@ -909,6 +903,10 @@ void init_locale( HMODULE module ) user_lcid = unix_locale_to_lcid( setlocale( LC_MESSAGES, NULL )); #ifdef __APPLE__ + { + const struct norm_table *info; + load_norm_table( NormalizationC, &info ); + } if (!system_lcid) { char buffer[LOCALE_NAME_MAX_LENGTH];
6. Then I ran configure again successfully
$ ./configure -enable-win64 $ make $ sudo make install
Took a while, but was successful.
7. I fixed some X11 issues
$ ll /usr/ total 0 lrwxr-xr-x 1 root wheel 25 Nov 6 15:21 X11@ -> ../private/var/select/X11 $ cd /private/var/select/ $ sudo ln -s /opt/X11 .
8.Moment of truth:
$ wine64 ../npp.7.bin.x64/notepad++.exe
9. I had to install more packages that WineHQ UI asks for a got few Mac OS X pop-up:
“notepad++.exe” cannot be opened because the developer cannot be verified. macOS cannot verify that this app is free from malware.
10. I went to System Preferences and allowed the executable by clicking “Allow Anyway”
11. Finally, it worked.
My Actual Journey to Discover the Above Solution
The Standard Instructions That Did Not Work
1. Downloaded WineHQ pkg for MacOS X from https://dl.winehq.org/wine-builds/macosx/download.html
2. It asked to me have the latest XQuartz installed. So I downloaded XQuartz 2.7.7 dmg from https://www.xquartz.org/releases/XQuartz-2.7.7.html. It installed successfully.
3. I tried reinstalling Wine again and it moved ahead this time. I chose 64-bit support (optional) while installing.
4. However, when I ran it from the Applications folder, I for an error that it needs to be updated and lead me to this page: https://support.apple.com/en-us/HT208436
Making WineHQ Work on MacOS Catalina
1. I wanted to use HomeBrew, so I ran this command from https://brew.sh/.
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
2. I followed instructions from https://wiki.winehq.org/MacOS/Building and downloaded version 5.3 from https://dl.winehq.org/wine/source/5.x/
$ brew install bison flex mingw-w64 pkgconfig $ cd wine-5.3 $ ./configure CC="clang" CXX="clang++" CFLAGS="-std=gnu89 -g" configure: error: Cannot build a 32-bit program, you need to install 32-bit development libraries.
3. I found this link and started following instructions: https://apple.stackexchange.com/questions/373851/how-to-get-wine-working-on-catalina. So I updated the command:
$ ./configure -enable-win64 configure: error: Your bison version is too old. Please install bison version 3.0 or newer. $ which bison /usr/bin/bison
4. I wanted to use HomeBrew, so I ran this command from https://brew.sh/.
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
5. From https://stackoverflow.com/questions/10778905/why-does-my-mac-os-x-10-7-3-have-an-old-version-2-3-of-gnu-bison/30844621#30844621 I realised that Mac has older version and thus upgraded it.
$ brew install bison $ brew link bison --force
6. I updated ~/vi .bash_profile and added
$ export PATH=/usr/local/Cellar/bison/3.5.3/bin:$PATH
7. Opened a new window which had the path updated
$ which bison /usr/local/Cellar/bison/3.5.3/bin/bison
8. I ran configure again successfully
$ ./configure -enable-win64 $ make $ sudo make install
Took a while, but was successful.
9. I had to fix some X11 links.
$ ll /usr/ total 0 lrwxr-xr-x 1 root wheel 25 Nov 6 15:21 X11@ -> ../private/var/select/X11 $ cd /private/var/select/ $ sudo ln -s /opt/X11 .
10. Moment of truth
$ wine64 ../npp.7.bin.x64/notepad++.exe Segmentation fault: 11
Whaaaaaa ……..
11. Seems like this is a known bug https://bugs.winehq.org/show_bug.cgi?id=48689 and the fix has been provided here: https://source.winehq.org/git/wine.git/blobdiff/76606eaea034c51a73190aac92e75d8b20e82164..35c223850e1bc9e8f97bfaf403bfabca69db3447:/dlls/ntdll/locale.c
12. Edited wine-5.3/dlls/ntdll/locale.c accordingly (though the line numbers did not match), deleted locale.o and restarted
$ ./configure -enable-win64 $ make $ sudo make install
13. Phew! No Segmentation faults. However, there are more hurdles. After waiting for a while, I got 2 issues.
$ wine64 npp.7.bin.x64/notepad++.exe 0019:err:environ:run_wineboot boot event wait timed out Wine cannot find the FreeType font library. To enable Wine to use TrueType fonts please install a version of FreeType greater than or equal to 2.0.5. http://www.freetype.org
and via a Mac OS X pop-up:
“notepad++.exe” cannot be opened because the developer cannot be verified. macOS cannot verify that this app is free from malware.
14. I went to System Preferences and allowed the executable by clicking “Allow Anyway”
15. Then I installed FreeType using HomeBrew
brew install freetype
16. Tried again and had to repeat the step-14 multiple times for various DLLs. I had to export another env variable in ~/.bash_profile
export DYLD_FALLBACK_LIBRARY_PATH=/usr/X11/lib:/usr/local/lib:/usr/local/libpng
Finally, NotePad++ worked!