With its robust app suite, a sleek yet intuitive interface, and solid integration with Apple devices, macOS has traded blows with Windows and Linux for well over a few decades. However, one of the biggest downsides of MacOS is that the operating system is restricted to Apple’s proprietary hardware. Considering how Hackintosh setups are on their last legs, you’ll have to shell out extra money on a MacBook, Mac Studio, Mac Mini, or an iMac to get the full macOS experience.
…Or so you might think. Thanks to the power of virtualization, it’s possible to run macOS on top of unsupported hardware. Having previously set up macOS inside a Proxmox VM, I decided to work on an even wackier project: installing Apple’s flagship desktop OS on a Docker container. If that sounds interesting to you, then here’s a log of the steps I took and obstacles I encountered when attempting to run a containerized version of macOS.
Getting all the dependencies ready
And solving the first set of roadblocks
After picking Debian as my preferred distro, I chose the Docker-OSX package by developer sickcodes for this project, as it provides a relatively simple means to run your preferred version of macOS – at least in theory. A few weeks ago, Apple issued a DMCA notice against the repo, and as of writing, any attempts to run the script result in an error message.
Thankfully, it’s possible to find mirrors of the package on the Internet, though the one I found was about Ventura rather than Sonoma or the more recently released Sequoia. Nevertheless, the project was back on track, but I had to install a couple of dependencies before I could proceed onward.
Aside from the ol’ reliable Docker Engine, I installed KVM, Qemu, and their respective packages using the sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils virtinst libvirt-daemon -y command. Thereafter, I ran the docker run command for the clone repo, which took a while to download and extract the packages. With multiple lines of code flashing across the screen at breakneck speed, I finally felt as though the project would go off without a hitch. That feeling lasted for a whole minute before I ran into the next issue.
Troubleshooting the rest of the issues
And finally installing macOS inside the container
Since I was executing the scripts inside the terminal, it was easy to keep an eye on the errors plaguing this insane project. Every time I ran the script, it would crash after displaying the Audio: Could not create a backend for voice ‘adc’ message. Given the word audio and several occurrences of the sound-related alsa-lib package in the terminal, I spent the next couple of minutes updating the audio and GPU drivers. But as it turned out, the issue had nothing to do with sound whatsoever.
Instead, the crash was entirely caused by the X11 server. The solution was as simple as adding my current user to the Docker group and executing xhost + before running the docker run command to grab the files. Although the alsa-lib errors appeared on the terminal, the script didn’t crash like the last time. Soon, the window for the Qemu emulator appeared, and I arrived at the familiar macOS Recovery screen. However, attempting to set up the operating system without making any tweaks was a mistake on my part, as I didn’t get the option to pick the correct (virtual) boot drive for macOS.
So, I terminated the script before running it once again. But this time, I selected the Disk Utility option, erased the QEMU HARDDISK Media partition, and renamed it macos. After that, I was finally able to select this disk after picking the Reinstall macOS Ventura option. Next, I played the waiting game for an hour and a half, and during this time, the container restarted a couple of times. All I had to do was select the macOS Installer drive before finally launching the drive titled macOS.
Performance and software support
Minus the slowdowns during the initial setup, it’s surprisingly snappy
With that, the all-familiar macOS initialization wizard popped up, and I had to navigate through a maze of options to configure the containerized instance of Ventura. The problem? The performance plummets during this step. Heck, the mouse latency was so terrible that I had to spend half a minute bringing the mouse to the Continue button. After surviving the ordeal, I was greeted by the macOS Dashboard and all the pre-installed apps.
Launching the About This Mac utility revealed that macOS identified the hardware as a 2017 iMac Pro with a 3.2GHz processor and 4GB of RAM. I also tested a handful of apps, with Freeform, Notability, CraftNotes, and other lightweight tools performing exceedingly well. Aside from a weird bug where Safari failed to display anything besides the background color when browning websites, I didn’t find any deal-breaking issues with the built-in apps or the software I downloaded from the App Store.
So, is it possible to run macOS inside a Docker container?
Very much so! Truth be told, I wasn’t very confident about the performance – or even the feasibility – of setting up macOS inside a container. While there’s the occasional latency during normal operations, you can still experiment with many macOS apps and have a somewhat decent experience on a container-based version of Apple’s premium operating system.
Related
I tried running some macOS apps on Proxmox, here’s how it went
As long as you have a fast processor, adequate RAM, and a boatload of patience, you can run a surprising number of apps on your Proxmox Hackintosh