Relevant KLayout version: 0.30.5
Author: Kazzz-S
Last modified: 2025-11-10
# 1. Introduction This directory **`macbuild`** contains various files required for building KLayout (http://www.klayout.de/) version 0.30.5 or later for different 64-bit macOS, including: * Tahoe (26.x) : really experimental (on M4 Mac Mini) * Sequoia (15.x) : the primary development environment * Sonoma (14.x) : experimental Building KLayout for the previous operating systems listed below has been discontinued.
Pre-built DMG packages are also not provided.
As of today (November 2025), Homebrew classifies macOS Catalina 10.15 - Ventura 13 as Tier 3. * Ventura (13.7.8; the build would still be possible) * Monterey (12.7.6; the build would still be possible) * Big Sur (11.7.10) * Catalina (10.15.7) * Mojave (10.14) * High Sierra (10.13) * Sierra (10.12) * El Capitan (10.11) Throughout this document, the primary target machine is **Intel x86_64** with **macOS Sequoia**.
The author recently acquired an M4 Mac Mini and is attempting to build a native ARM64 version in the Tahoe environment **experimentally**.
Therefore, this document does not include detailed build procedures for Apple Silicon environments.
However, they are essentially the same as for an Intel Mac. # 2. Qt Frameworks The default Qt framework is "Qt5" from **MacPorts** (https://www.macports.org/), which is usually located under: ``` /opt/local/libexec/qt5/ ``` If you prefer "Qt6" from **Homebrew** (https://brew.sh/), which is usually located under: ``` /usr/local/opt/qt@6/ ``` You can also choose "Qt6" from Anaconda3 (https://www.anaconda.com/), but its setup is a little complicated in this release. First, install Anaconda3 under /Applications.
If you have installed Anaconda3 under $HOME/opt/anaconda3/ (or other location), make a symbolic link: ``` /Applications/anaconda3/ ---> $HOME/opt/anaconda3/ ``` Then, follow the instructions in Section 6F. The migration work to "Qt6" is ongoing. You can try to use it; however, you might encounter some build or runtime errors.
If you use **Homebrew** to build KLayout >= 0.29.0, you need "Qt6" to address [the compilation issue](https://github.com/KLayout/klayout/issues/1599).
I have also tried migrating to "Python 3.13.x" (earlier, Python 3.12.x) in this version. # 3. Script language support: Ruby and Python The build script **`build4mac.py`** provides several possible combinations of Qt, Ruby, and Python modules to suit the user's needs and preferences.
Some typical use cases are described in Section 6. # 4. Prerequisites You need to have the followings: * The latest Xcode and command-line tool kit compliant with each OS * https://developer.apple.com/xcode/resources/ * https://mac.install.guide/commandlinetools/4 * Qt5 package from MacPorts. Qt6, from Homebrew or Anaconda3. * libgit2 form MacPorts, Homebrew, or Anaconda3. * Optionally, Ruby and Python packages from MacPorts, Homebrew, or Anaconda3 #### For matching versions of Ruby and Python, please also refer to `build4mac_env.py`. # 5. Command-line options of **`build4mac.py`** **`build4mac.py`** is the top level Python script for building KLayout for a macOS. The operating system type is detected automatically. ``` ----------------------------------------------------------------------------------------------------------- << Usage of 'build4mac.py' >> for building KLayout 0.30.5 or later on different Apple macOS platforms. $ [python] ./build4mac.py option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details) | default value ----------------------------------------------------------------------------------------+--------------- [-q|--qt ] : case-insensitive type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3', | qt5macports : 'Qt6MacPorts', 'Qt6Brew', 'Qt6Ana3''] | : Qt5MacPorts: use Qt5 from MacPorts | : Qt5Brew: use Qt5 from Homebrew | : Qt5Ana3: use Qt5 from Anaconda3 | : Qt6MacPorts: use Qt6 from MacPorts (*) | : Qt6Brew: use Qt6 from Homebrew (*) | : Qt6Ana3: use Qt6 from Anaconda3 (*) | : (*) migration to Qt6 is ongoing | [-r|--ruby ] : case-insensitive type=['nil', 'Sys', 'MP34', 'HB34', 'Ana3'] | sys : nil: don't bind Ruby | : Sys: use [Tahoe|Sequoia|Sonoma]-bundled Ruby 2.6 | : MP34: use Ruby 3.4 from MacPorts | : HB34: use Ruby 3.4 from Homebrew | : Ana3: use Ruby 3.4 from Anaconda3 | [-p|--python ] : case-insensitive type=['nil', 'Sys', 'MP313', 'HB313', 'Ana3', | sys : 'MP312', 'MP312', | : 'MP311', 'HB311', 'HBAuto'] | : nil: don't bind Python | : Sys: use [Tahoe|Sequoia|Sonoma]-bundled Python 3.9 | : MP313: use Python 3.13 from MacPorts | : HB313: use Python 3.13 from Homebrew | : Ana3: use Python 3.13 from Anaconda3 | : MP312: use Python 3.12 from MacPorts | : HB312: use Python 3.12 from Homebrew | : MP311: use Python 3.11 from MacPorts | : HB311: use Python 3.11 from Homebrew (+) | : (+) required to provide the legacy pip in HW-*.dmg | : HBAuto: use the latest Python 3.x auto-detected from Homebrew | [-P|--buildPymod] : build and deploy Pymod (*.whl) for LW-*.dmg | disabled [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled [-u|--noqtuitools] : don't include uitools in Qt binding | disabled [-g|--nolibgit2] : don't include libgit2 for Git package support | disabled [-m|--make