How to Create a macOS Virtual Machine Using Docker

Apple’s macOS is an aesthetic wonder, offering out-of-the-box good looks, great tools, and integration across the entire Apple ecosystem.

If you don’t want to buy Apple’s hardware, a Hackintosh or a virtual machine is usually the way to go. But if you want to run macOS, and you’re in a hurry, there’s no better option than Docker-OSX, which allows you to instantly create any macOS virtual machine on Linux.

4

Why Not Set Up a Virtual Machine to Run macOS?

A virtual machine is the digital equivalent of an actual computer, and on which you can run any software that you would be able to run on a physical computer. You can run Windows within Linux, Linux within macOS, and any combination of these.

VMs are great for testing out new operating systems or distros, for providing tutorial screenshots, and for using OS-specific tools which don’t work well through emulation or compatibility layers.

a lady using macos on a macbook air

Examples of this type of software include Adobe’s creative suite, which was originally designed to run on the Apple Macintosh and was later ported to Windows.Running Photoshop on Linuxis difficult and usually requires you to use a virtual machine.

Butsetting up a dedicated virtual macOS machinein VirtualBox or VMware Workstation Player is a time-consuming operation, with multiple steps and a great deal of configuration. You also need to download the operating systems and go through the entire installation process.

macOS Catalina running on Ubuntu with Docker-OSX

Instead of spending hours fiddling with VM settings, you could be editing videos, creating cool artwork, or mixing new music.

Docker-OSX Makes It Easy to Instantly Create a macOS VM

Docker-OSX is a tool that allows you to spin up a macOS image almost instantly and offers near-native performance. With a single command, you can have macOS Catalina running on your desktop, or create a fresh installation of macOS Big Sur, Monterey, or Ventura. If you have got a hankering for older systems, you can use High Sierra and Mojave, too.

In case you’re worried about missing some Apple functionality, Docker-OSX supports iPhone USB passthrough, and allows you to share directories, files, and folders with the host system.

Demonstration of macOS Ventura on a MacBook Pro

Get Started With Docker-OSX on Linux

Before it’s possible to use Docker-OSX to quickly create a macOS VM on your Linux system, you need to have Docker installed.

If you’re using Debian or Ubuntu, run the following command:

Several laptops side by side with different Linux distributions.

To install Docker on Fedora, RHEL, or its derivatives:

If you use Arch Linux or derivatives, run:

Docker is now installed on your system. Start and enable it with:

Now add your user to the docker group with:

Log out, then back in again to save the changes.

You also need to install QEMU and some additional dependencies to ensure the virtual machine runs as expected. To install QEMU on Debian and Ubuntu, run:

If Arch Linux is your preferred distro, use the following command:

To install QEMU on Red Hat Enterprise Linux, Fedora, CentOS, or Rocky Linux, run:

Next, enable libvirt and load the KVM kernel module with the following commands:

With that out of the way, you’re ready to start pulling macOS Docker images.

The most straightforward option is to go with a ready-to-run macOS Catalina image. Although the OS was only released in 2019, Apple officially stopped supporting it on November 30, 2022. Nonetheless, it’s still a relatively modern and very capable desktop you may use to get things done.

Open a terminal and enter:

While you make a cup of tea or catalog your groceries, Docker will pull the relevant image, and when you return you will be looking at a macOS Catalina login screen. The image is configured so that you can log in straight away with the username “user”, and the password “alpine”.

That’s it. A single line in your terminal, and you’re running macOS with a 20GB virtual hard drive!

While that’s certainly quick, you might want to install macOS from scratch and set your own username and password. Docker-OSX provides multiple images which can help you do that. Simply pop open a terminal and enter the appropriate command from below.

Use Docker-OSX to create a clean macOS Catalina install:

Use Docker-OSX to create a clean macOS Big Sur install:

Run the following command to create a clean macOS Monterey install:

Use Docker-OSX to create a clean macOS Ventura install:

To create a clean macOS High Sierra install, run:

Create a clean macOS Mojave install with:

Running macOS on Linux Has Never Been Easier!

Now you’re able to create macOS machines on demand with a minimum of fuss, there’s no limit to your creative options, and you can install macOS-specific apps without problems. The macOS software ecosystem is very different from what you’re used to with Linux and there isn’t nearly so much open-source software.

Take a good look around Apple’s operating system and become familiar with the most essential features to make your life easier.

If you’re looking to make the most of your Mac, you need to check out our list of all the best macOS features.

Don’t let aging hardware force you into buying expensive upgrades.

The best features aren’t the ones being advertised.

I plugged random USB devices into my phone and was pleasantly surprised by how many actually worked.

OneDrive is one of the best, but it has a catch.

It saves me hours and keeps my sanity intact.

Technology Explained

PC & Mobile