Wine 可以幫我們在 Mac 上執行 Windows 的執行檔而不需安裝 Windows。本篇簡單記述一下如何執行 wine 來跑 中研院的 ShpTrans 轉換座標軟體。
所需軟體:
- WineHQ : https://www.winehq.org/
測試環境:
Mac OSX 10.12.3
$ brew info wine wine: stable 2.0 (bottled), devel 2.2, HEAD Run Windows applications without a copy of Microsoft Windows https://www.winehq.org/ /usr/local/Cellar/wine/1.8.6 (3,943 files, 404.8MB) Built from source on 2017-02-07 at 15:21:32 with: --with-libgsm /usr/local/Cellar/wine/2.0 (4,297 files, 462.0MB) * Built from source on 2017-02-20 at 11:15:56 with: --with-libgsm From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wine.rb ==> Dependencies Build: pkg-config ✔, cmake ✔, makedepend ✔ ==> Requirements Build: xcode ✔ Recommended: x11 ✔ ==> Options --without-win64 Build without 64-bit support --without-x11 Build without x11 support --devel Install development version 2.2 --HEAD Install HEAD version ==> Caveats You may want to get winetricks: brew install winetricks By default Wine uses a native Mac driver. To switch to the X11 driver, use regedit to set the "graphics" key under "HKCUSoftwareWineDrivers" to "x11" (or use winetricks). For best results with X11, install the latest version of XQuartz: https://xquartz.macosforge.org/
步驟:
如果直接執行:
wine ShpTrans.exe
會遇到字體找不到的問題:
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 fixme:keyboard:macdrv_ActivateKeyboardLayout flags 1 not supported
然後就完全沒有畫面。

查詢了官方網站的 FAQ 以後,發現要用下面的指令:
DYLD_FALLBACK_LIBRARY_PATH=/usr/X11/lib wine ShpTrans.exe
就可以成功執行了:

Mac 的目錄會在 Z:\ 這個磁碟代號下面。