Last Updated:
macbook pro open on a desktop

MacOS on Linux is easier than you think

David Rutland
David Rutland Software

MacOS is weird. It's kind of like Linux, but also not. It's based on the open-source Darwin OS, but everything that makes the OS usable in the 21st century is proprietary. It has a recognisable and usable terminal, but you can't use it to access all parts of the OS and tweak the innards to how you want them. You don't have control.

Every now and then, however, it becomes necessary to run some piece of macOS software that's not available on Linux. There's no Final Cut Pro for Linux, nor any GarageBand - so creating professional level singles and the associated MTV-style music videos isn't an option.

Running MacOS software can be a bitch if you don't have a Mac

If you have a desperate need to run some MacOS only software, your options are limited, and we've laid them out for you below:

Buy a Mac

Pros:

  • MacOS software will run as it should, on the hardware it was designed for.

Cons:

  • Macs are expensive.

  • The clean aesthetic doesn't suit your tinkerer lifestyle, or the rest of your home.

  • It's a Mac.

  • You don't actually want to own a Mac.

Build a Hackintosh

Pros:

  • Considerably cheaper than a Mac

  • Can be as ugly or weird as you like.

  • Building a Hackintosh and getting it working will keep you busy for days.

Cons:

  • While cheaper than a genuine Apple product, it's still not cheap.

  • Yet another computer in the house

  • Building a Hackintosh and getting it working will keep you busy for days.

Run MacOS in VirtualBox

Pros:

  • Free!

Cons:

  • Fairly difficult and involved.

We should note at this point that MacOS is only licensed to be run on approved and genuine Apple hardware.

The easiest way to run MacOS on your Linux system

A face stencilled in black on a yellow paving slab leaning against a brick wall

Fortunately for you there's another way to run MacOS software on your Linux PC, thanks to Docker-OSX - a GPL3-licensed open-source project from Sick Codes dedicated to getting proprietary Apple code working on your Linux machine as quickly and smoothly as possible.

Docker-OSX relies on a KVM virtualisation built atop KVM-OpenCore, and unlike a virtual machine that you have to set up and configure yourself, is containerised with Docker (it's in the name).

What this means is everything is preconfigured and ready to go. You don't need to worry - it will just work.

The project has an impressive array of macOS versions on offer, so if you need a particular software version tied to a specific OS version, or just like the aesthetics, you can choose from (in no particular order) High Sierra, Mojave, Catalina, Big Sur, Monterey, or Ventura.

It's also worth noting that the project also uses OSX Serial Generator - another project from Sick Codes - that generates valid OSX serial numbers, allowing you use to iMessage on your virtual Mac.

Get a virtual mac on Linux in minutes

An imac in a pastel lit room

Well, minutes might be a tiny bit misleading unless you have an insanely fast internet connection and the stars are aligned in a certain way. We actually managed to have a fully useable desktop in about half an hour. Your mileage may vary according to your provider, and the specs of your machine.

Before you start, make sure you have Docker and Docker Compose installed. In theory, Docker-OSX ought to work with Podman, too - although we haven't tried this.

You'll also need some additional dependencies. Grab them with the commands below:

On Debian-based systems:

sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager libguestfs-tools

For the Fedora family:

sudo yum install libvirt qemu-kvm

Arch and co:

sudo pacman -S qemu libvirt dnsmasq virt-manager bridge-utils flex bison iptables-nft edk2-ovmf

To try out Docker-OSX, we used the Catalina image.

docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    sickcodes/docker-osx:latest
standard macos utilities menu

At a mere 1.7GB, it took less than eight minutes until we were looking at an icon of a hard drive. You can press this or wait 30 seconds for setup to continue. Another minute and you'll be on the macOS utilities menu. Click on DIsk Utility, and find the the disk with the highest capacity. Click Erase, then give a name to the disk that will take its place. "Mydisk" is good if you're searching for inspiration. Leave the Format and Scheme with their default values. Click Erase when you're happy, then the big blue Done button when it's done. When you return to the Disk Utility menu, you should see your new disk name listed on the left.

With that out of the way, leave the Disk Utility, and then press on Reinstall macOS. Go through the prompts, and you're done. Welcome to the macOS life!

For Big Sur, the command is:

docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    sickcodes/docker-osx:big-sur

For Monterey:

docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    -e GENERATE_UNIQUE=true \
    -e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist' \
    sickcodes/docker-osx:monterey

...and for Ventura:

docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    -e GENERATE_UNIQUE=true \
    -e MASTER_PLIST_URL='https://raw.githubusercontent.com/sickcodes/osx-serial-generator/master/config-custom.plist' \
    sickcodes/docker-osx:ventura

But who can be bothered going through the macOSX setup process? It's dull, and you have better things to do with your time.

If you want to swerve the chore of clicking through screens, theeasiest way to get your Virtual Mac up and running is to use the pre-installed Catalina image. It's completely hands-off, but it isn't the quickest. The Download itself is in excess of 20GB, and you'll need at least 40GB free on your host machine.

If you want to go with this option, pop open a terminal, and enter:

docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    -e GENERATE_UNIQUE=true \
    sickcodes/docker-osx:auto

Take the dogs for a walk, browse the web without encountering paywalls, spin up an XMPP server, or listen to an audiobook. This will take a bit.

When it's done, you'll be on the login screen of a brand new Catalina install. The username is user, and the password is alpine.

The preinstalled image is cool and super-easy, and we'd suggest using this one if you genuinely have better things to be getting on with.

Are you really a security researcher?

macos desktop with calendar and app store open

Sick Codes can use and distribute proprietary Apple software because he's a security researcher doing security researcher things. We're not 100 percent sure how that works, but we're taking it at face value.

In the project documentation, you'll see numerous references to it being used for security research, and there are terms and conditions attached to Docker-OSX.

By using this Dockerfile, you hereby agree that you are a security reseacher or developer and agree to use this Dockerfile to make the world a safer place. Examples include: making your apps safer, finding your mobile phone, compiling security products, etc. You understand that Docker-OSX is an Open Source project, which is released to the public under the GNU Pulic License version 3 and above. You acknowledge that the Open Source project is absolutely unaffiliated with any third party, in any form whatsoever. Any trademarks or intelectual property which happen to be mentioned anywhere in or around the project are owned by their respective owners. By using this Dockerfile, you agree to agree to the EULA of each piece of upstream or downstream software. The following code is released for the sole purpose of security research, under the GNU Public License version 3. If you are concerned about the licensing, please note that this project is not AGPL.

We're pretty sure that Apple isn't going to check your security credentials or sue you for using their god-awful browser instead of making the world a safer place, but we couldn't say for sure.

How does macOS run on Linux?

Pretty well, we found - although in all honesty, we only tried out Catalina. Everything was buttery smooth, and without lag. Our test machine is a Gigabyte G5 laptop (16GB / RTX3060 mobile): pretty mid range. Your performance will vary depending on whether your hardware is more or less capable than ours.