You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
arm64 macOS: embed ruby and python for pre-built binaries? #2522
The pre-built binaries over at https://www.klayout.de/build.html use the "OS-bundled Ruby". This presents some challenges at this point.
One is the bundled Ruby is on its way out: this message is printed when I launch irb on macOS 27:
WARNING: This version of ruby is included in macOS for compatibility with legacy software.
In future versions of macOS the ruby runtime will not be available by
default, and may require you to install an additional package.
The other is Ruby 2.6 is very out of date, and some DRC decks for open-source PDKs written for KLayout require a more up-to-date version of Ruby.
I am aware there are options for Conda and MacPorts, but neither have the install base of Homebrew - but even if there was a qt6Brew version like x86-64, it would be nicer if there's an option that, however heavy, just works for our use-case OOTB completely independently of the user's environment.
Thanks for the suggestion, Donn, and thanks, Matthias, for inviting me to share my thoughts.
Please bear with me, as this will be a rather long response.
I am aware that the macOS-bundled Ruby 2.6 is outdated and that Apple may eventually stop providing Ruby altogether.
I also understand that some DRC decks require a newer Ruby version.
However, based on my experience building and distributing KLayout binaries for macOS, I have a somewhat different perspective on embedding Ruby and Python in KLayout.app.
1. Mac KLayout Distribution Models and Their Background
I have been building and distributing KLayout binaries for macOS for over 11 years.
During that time, the landscape surrounding Apple’s hardware, macOS, Qt, Ruby, Python, and package managers has changed considerably.
Currently, I provide three types of DMG packages.
ST (Standard)
This package embeds Qt5 from MacPorts into KLayout.app while relying on Apple’s OS-bundled Ruby 2.6 and Python 3.9.
Using Python requires Apple’s Command Line Tools, but users do not need to set up separate Ruby or Python development environments.
HW (Heavyweight)
In addition to Qt5 from MacPorts, this package embeds Python 3.11 from Homebrew. It still relies on Apple’s Ruby 2.6.
The HW model was not originally my idea. As I understand it, it arose from a request by people at educational institutions who wanted students, even those unfamiliar with system administration, to use KLayout with Python 3 immediately.
Since their primary focus was Python 3, I assume they deliberately chose not to embed Ruby.
At that time, Apple’s default Python was 2.7, so embedding Python 3 offered a significant benefit.
LW (Lightweight)
This package does not embed Qt, Ruby, Python, or related runtime environments in KLayout.app.
Instead, users are expected to prepare them through MacPorts, Homebrew, or Anaconda3.
However, users do not need to build KLayout from source. I provide the pre-built application.
I like to think of this as the Curry & Rice model.
Recently, an old friend from India gave me some MTR Ready-to-Eat curry.
The curry is already cooked, but to enjoy it, I still need to heat it up and prepare the rice myself.
LW works in much the same way. I have already cooked the curry—KLayout—so users only need to prepare the rice: the Qt, Ruby, Python, and other runtime components.
The available combinations and the procedures for building KLayout from source are documented in macbuild/ReadMe.md.
2. Changes in the Homebrew Landscape
Recently, I have been considering reducing my reliance on Homebrew when distributing KLayout for macOS.
One reason is Homebrew’s policy toward Intel Macs.
As of September 2026, Homebrew no longer supports macOS on Intel x86_64 and explicitly recommends MacPorts to Intel Mac users.
For example, brew upgrade on my Intel Mac displays the following warning:
MacBookPro2{sekigawa} ~ (1)% brew upgrade
Warning: You are using macOS on Intel x86_64.
We do not provide support for this platform (as-of September 2026, announced August 2025).
Apple have dropped Intel x86_64 support in macOS Golden Gate (27).
GitHub Actions are dropping macOS Intel x86_64 runners in 2027.
Homebrew is a non-profit project run entirely by volunteers, not employees.
If the biggest companies in the world cannot support macOS Intel x86_64
any longer, sadly neither can we.
You will have better luck with MacPorts which still supports macOS Intel x86_64:
https://www.macports.org/
Of course, Intel Macs will eventually fade away. Nevertheless, I suspect that a significant number of KLayout users are still running Intel Macs.
I have also encountered problems with Qt5 from Homebrew in the past, so I have preferred the more reliable MacPorts version (KLayout Issue #1599).
Consequently, even my HW package has a mixed configuration: Qt5 from MacPorts and Python 3.11 from Homebrew.
There are also issues with Python itself.
Starting with Homebrew’s Python 3.12, PEP 668 restricts the traditional use of pip to install packages into the globally managed environment and recommends using virtual environments.
To preserve the convenience of the HW package, I have continued using Python 3.11. However, on Apple Silicon running macOS Tahoe, installation and upgrades of Homebrew’s Python 3.11 have repeatedly failed.
Even the recent upgrade to Python 3.11.18 failed during the post-install step because the ensurepip process was terminated by SIGKILL.
Under these circumstances, continuing to embed Homebrew’s Python in KLayout is becoming increasingly difficult to maintain.
3. Embedding Everything Is Not Necessarily the Best Solution
I fully understand the appeal of an OOTB experience, where users can download an application and start using it immediately.
However, embedding Ruby and Python is not necessarily the best solution for every user.
For example, the Windows version of KLayout bundles Qt, Ruby, Python, and other runtime components. However, when users want to add their own Python modules, compatibility with the bundled Python environment can become an issue.
In contrast, Linux KLayout binaries generally rely on Qt, Ruby, Python, and other packages provided by the operating system’s package management system.
I believe a similar LW approach is reasonable for macOS, particularly for users who actively work with Ruby and Python.
Here, I would like to emphasize another point.
As I understand it, the HW model was originally conceived to simplify installation in educational environments.
However, in practice, I don't think there is a significant difference in effort between installing HW and preparing the environment LW requires.
For example, to use the MacPorts-based LW package, users only need to install MacPorts and a handful of specified packages. There is no need to compile KLayout themselves.
With a well-written installation procedure, even users without much programming experience should be able to install and use LW without significant difficulty.
Moreover, preparing such documentation is largely a one-time job.
Of course, occasional updates will be necessary as macOS and individual packages evolve, but the procedure does not need to be recreated from scratch for every release.
For educational institutions in particular, I believe it is necessary to decide in advance which versions of KLayout, Ruby, Python, and additional modules will be used, based on the curriculum or syllabus.
Preparing a suitable installation procedure is therefore not merely unavoidable; it is also an important part of ensuring that the course runs smoothly.
In addition, the LW approach allows users to manage their own Ruby and Python versions and install additional modules as needed.
For these reasons, I consider maintaining a clear LW installation procedure a more practical long-term approach than pursuing a completely self-contained OOTB package that requires continuous maintenance of bundled runtimes.
4. My Plans for Future Mac Distributions
For the reasons described above, I am considering simplifying the Mac DMG packages I provide into two main categories: ST and LW.
ST: For general users
As long as Apple continues providing Ruby 2.6 and Python 3.9, I intend to maintain the current simple configuration.
I am fully aware that Python 3.9 has reached EOL upstream. However, Apple continues to provide it and appears to be maintaining it independently.
For example, the latest build I have observed reports: Python 3.9.6 (default, Aug 25 2026, 21:26:21)
I take a similar view of Apple’s bundled Ruby.
If Apple eventually stops providing Ruby, I will reconsider the situation at that time.
LW: For users who need newer Ruby/Python versions
My preferred approach is to use MacPorts, currently with Ruby 3.4 and Python 3.14.
I expect upgrading to Ruby 4.x may also be possible, though I haven't tested it yet.
Users need to prepare the required packages themselves, but KLayout is already built and ready to use.
Regarding Qt6, both ST and LW had previously reached the point where they could operate with full functionality.
Unfortunately, a new build issue has appeared with Qt 6.12 (Issue #2515). Once that is resolved, I expect we can return to fully functional Qt6 builds.
I also appreciate that maintaining compatibility across such a wide range of Qt versions, from Qt4 through Qt6, must be a considerable burden for Matthias.
For my part, I'm simplifying the Mac distribution models to reduce the growing workload of building, testing, and distributing so many combinations.
5. Regarding Donn’s Proposal
Everything I have described above reflects my own plans for distributing Mac binaries.
I have absolutely no objection to Donn developing an HW package that embeds newer versions of Ruby and Python. On the contrary, I would welcome it.
The HW model itself originated from ideas proposed by others.
I have no intention of removing HW-related functionality from build4mac.py.
Anyone is free to improve the HW-related parts or modify other parts of the build scripts as needed.
However, I have never experimented with embedding MacPorts Ruby 3.4 or Python 3.14 directly into KLayout.app.
Therefore, I cannot yet comment with confidence on the implementation details or potential technical difficulties.
If Donn develops a new HW package and is willing to build and maintain it on an ongoing basis, I think it would be perfectly reasonable to make it available through the official KLayout download page, just as my packages are today.
Of course, Matthias would make the final decision about hosting it there.
I am sure there would be users who would appreciate such a package.
In other words, instead of one person providing Mac binaries for KLayout, two contributors would share that role.
To me, that seems like a very natural and positive development for an open-source project.
6. Finally, a Small Personal Note
About a year ago, I acquired my first Apple Silicon machine, an M4 Mac mini, and I was amazed by the performance difference compared with my previous Intel Macs.
In my environment, some of my KLayout PYA scripts run 3–4 times faster, and building KLayout itself is about 4–5 times faster. At those speeds, even building KLayout from source is no longer much of a burden.
Perhaps this kind of performance improvement also encourages Mac users to explore KLayout more actively and improve their development environments.
As a fellow Mac user, I am pleased to see people like Donn willing to get involved in development and contribute.
Activity
klayoutmatthias commentedon Oct 25, 2026
I'm still not a Mac user myself, but maybe @Kazzz-S has an opinion on this.
BR,
Matthias
Kazzz-S commentedon Oct 29, 2026
Hi @donn and @klayoutmatthias,
Thanks for the suggestion, Donn, and thanks, Matthias, for inviting me to share my thoughts.
Please bear with me, as this will be a rather long response.
I am aware that the macOS-bundled Ruby 2.6 is outdated and that Apple may eventually stop providing Ruby altogether.
I also understand that some DRC decks require a newer Ruby version.
However, based on my experience building and distributing KLayout binaries for macOS, I have a somewhat different perspective on embedding Ruby and Python in KLayout.app.
1. Mac KLayout Distribution Models and Their Background
I have been building and distributing KLayout binaries for macOS for over 11 years.
During that time, the landscape surrounding Apple’s hardware, macOS, Qt, Ruby, Python, and package managers has changed considerably.
Currently, I provide three types of DMG packages.
ST (Standard)
This package embeds Qt5 from MacPorts into
KLayout.appwhile relying on Apple’s OS-bundled Ruby 2.6 and Python 3.9.Using Python requires Apple’s Command Line Tools, but users do not need to set up separate Ruby or Python development environments.
HW (Heavyweight)
In addition to Qt5 from MacPorts, this package embeds Python 3.11 from Homebrew. It still relies on Apple’s Ruby 2.6.
The HW model was not originally my idea. As I understand it, it arose from a request by people at educational institutions who wanted students, even those unfamiliar with system administration, to use KLayout with Python 3 immediately.
Since their primary focus was Python 3, I assume they deliberately chose not to embed Ruby.
At that time, Apple’s default Python was 2.7, so embedding Python 3 offered a significant benefit.
LW (Lightweight)
This package does not embed Qt, Ruby, Python, or related runtime environments in
KLayout.app.Instead, users are expected to prepare them through MacPorts, Homebrew, or Anaconda3.
However, users do not need to build KLayout from source. I provide the pre-built application.
I like to think of this as the Curry & Rice model.
Recently, an old friend from India gave me some MTR Ready-to-Eat curry.
The curry is already cooked, but to enjoy it, I still need to heat it up and prepare the rice myself.
LW works in much the same way. I have already cooked the curry—KLayout—so users only need to prepare the rice: the Qt, Ruby, Python, and other runtime components.
The available combinations and the procedures for building KLayout from source are documented in macbuild/ReadMe.md.
2. Changes in the Homebrew Landscape
Recently, I have been considering reducing my reliance on Homebrew when distributing KLayout for macOS.
One reason is Homebrew’s policy toward Intel Macs.
As of September 2026, Homebrew no longer supports macOS on Intel x86_64 and explicitly recommends MacPorts to Intel Mac users.
For example,
brew upgradeon my Intel Mac displays the following warning:Of course, Intel Macs will eventually fade away. Nevertheless, I suspect that a significant number of KLayout users are still running Intel Macs.
I have also encountered problems with Qt5 from Homebrew in the past, so I have preferred the more reliable MacPorts version (KLayout Issue #1599).
Consequently, even my HW package has a mixed configuration: Qt5 from MacPorts and Python 3.11 from Homebrew.
There are also issues with Python itself.
Starting with Homebrew’s Python 3.12, PEP 668 restricts the traditional use of pip to install packages into the globally managed environment and recommends using virtual environments.
To preserve the convenience of the HW package, I have continued using Python 3.11. However, on Apple Silicon running macOS Tahoe, installation and upgrades of Homebrew’s Python 3.11 have repeatedly failed.
Even the recent upgrade to Python 3.11.18 failed during the post-install step because the ensurepip process was terminated by SIGKILL.
Under these circumstances, continuing to embed Homebrew’s Python in KLayout is becoming increasingly difficult to maintain.
3. Embedding Everything Is Not Necessarily the Best Solution
I fully understand the appeal of an OOTB experience, where users can download an application and start using it immediately.
However, embedding Ruby and Python is not necessarily the best solution for every user.
For example, the Windows version of KLayout bundles Qt, Ruby, Python, and other runtime components. However, when users want to add their own Python modules, compatibility with the bundled Python environment can become an issue.
In contrast, Linux KLayout binaries generally rely on Qt, Ruby, Python, and other packages provided by the operating system’s package management system.
I believe a similar LW approach is reasonable for macOS, particularly for users who actively work with Ruby and Python.
Here, I would like to emphasize another point.
As I understand it, the HW model was originally conceived to simplify installation in educational environments.
However, in practice, I don't think there is a significant difference in effort between installing HW and preparing the environment LW requires.
For example, to use the MacPorts-based LW package, users only need to install MacPorts and a handful of specified packages. There is no need to compile KLayout themselves.
With a well-written installation procedure, even users without much programming experience should be able to install and use LW without significant difficulty.
Moreover, preparing such documentation is largely a one-time job.
Of course, occasional updates will be necessary as macOS and individual packages evolve, but the procedure does not need to be recreated from scratch for every release.
For educational institutions in particular, I believe it is necessary to decide in advance which versions of KLayout, Ruby, Python, and additional modules will be used, based on the curriculum or syllabus.
Preparing a suitable installation procedure is therefore not merely unavoidable; it is also an important part of ensuring that the course runs smoothly.
In addition, the LW approach allows users to manage their own Ruby and Python versions and install additional modules as needed.
For these reasons, I consider maintaining a clear LW installation procedure a more practical long-term approach than pursuing a completely self-contained OOTB package that requires continuous maintenance of bundled runtimes.
4. My Plans for Future Mac Distributions
For the reasons described above, I am considering simplifying the Mac DMG packages I provide into two main categories: ST and LW.
ST: For general users
As long as Apple continues providing Ruby 2.6 and Python 3.9, I intend to maintain the current simple configuration.
I am fully aware that Python 3.9 has reached EOL upstream. However, Apple continues to provide it and appears to be maintaining it independently.
For example, the latest build I have observed reports:
Python 3.9.6 (default, Aug 25 2026, 21:26:21)I take a similar view of Apple’s bundled Ruby.
If Apple eventually stops providing Ruby, I will reconsider the situation at that time.
LW: For users who need newer Ruby/Python versions
My preferred approach is to use MacPorts, currently with Ruby 3.4 and Python 3.14.
I expect upgrading to Ruby 4.x may also be possible, though I haven't tested it yet.
Users need to prepare the required packages themselves, but KLayout is already built and ready to use.
Regarding Qt6, both ST and LW had previously reached the point where they could operate with full functionality.
Unfortunately, a new build issue has appeared with Qt 6.12 (Issue #2515). Once that is resolved, I expect we can return to fully functional Qt6 builds.
I also appreciate that maintaining compatibility across such a wide range of Qt versions, from Qt4 through Qt6, must be a considerable burden for Matthias.
For my part, I'm simplifying the Mac distribution models to reduce the growing workload of building, testing, and distributing so many combinations.
5. Regarding Donn’s Proposal
Everything I have described above reflects my own plans for distributing Mac binaries.
I have absolutely no objection to Donn developing an HW package that embeds newer versions of Ruby and Python. On the contrary, I would welcome it.
The HW model itself originated from ideas proposed by others.
I have no intention of removing HW-related functionality from
build4mac.py.Anyone is free to improve the HW-related parts or modify other parts of the build scripts as needed.
However, I have never experimented with embedding MacPorts Ruby 3.4 or Python 3.14 directly into KLayout.app.
Therefore, I cannot yet comment with confidence on the implementation details or potential technical difficulties.
If Donn develops a new HW package and is willing to build and maintain it on an ongoing basis, I think it would be perfectly reasonable to make it available through the official KLayout download page, just as my packages are today.
Of course, Matthias would make the final decision about hosting it there.
I am sure there would be users who would appreciate such a package.
In other words, instead of one person providing Mac binaries for KLayout, two contributors would share that role.
To me, that seems like a very natural and positive development for an open-source project.
6. Finally, a Small Personal Note
About a year ago, I acquired my first Apple Silicon machine, an M4 Mac mini, and I was amazed by the performance difference compared with my previous Intel Macs.
In my environment, some of my KLayout PYA scripts run 3–4 times faster, and building KLayout itself is about 4–5 times faster. At those speeds, even building KLayout from source is no longer much of a burden.
Perhaps this kind of performance improvement also encourages Mac users to explore KLayout more actively and improve their development environments.
As a fellow Mac user, I am pleased to see people like Donn willing to get involved in development and contribute.
Best regards,
Kazzz-S