We already have a tutorial on how to install macOS Catalina on Linux. A simple tutorial on how set up a macOS VM in QEMU, accelerated by KVM. This is basically the same tutorial but everything runs, near native with X11 forwarding, in Docker.
This is not a Docker tutorial, but let’s have a quick look at how to install it on Arch linux ( more info for Docker on Arch here ). For other distros as well as how to install Docker on macOS and Windows, check out the official installation guide here.
- ALSO READ HOW TO: Dual Boot macOS and Linux
- ALSO READ HOW TO: Install macOS Big Sur With OpenCore on Linux
1. Open up the terminal and type sudo pacman -S docker
2. Once Docker is installed type in sudo systemctl start docker
and sudo systemctl enable docker
3. By default only a user with root or sudo privilages can run or manage Docker. If you want to run Docker without root or having to add sudo every single time type sudo usermod -aG docker $USER
4. Reboot your machine
Install macOS in a Docker container
1. Make sure you have hardware virtualization turned on in BIOS
2. Install QEMU and requirements on the machine. Open up a terminal and type:
- Arch:
sudo pacman -S qemu libvirt dnsmasq virt-manager bridge-utils flex bison ebtables edk2-ovmf
- Debian/Ubuntu:
sudo apt install qemu qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virt-manager
- CentOS/Rhel/Fedora:
sudo yum install libvirt qemu-kvm -y
3. Now, run:
sudo systemctl enable libvirtd.service
sudo systemctl enable virtlogd.service
sudo modprobe kvm
4. Reboot your machine
5. Now pull the image with docker pull sickcodes/docker-osx
6. Run docker run --privileged -e "DISPLAY=${DISPLAY:-:0.0}" -v /tmp/.X11-unix:/tmp/.X11-unix sickcodes/docker-osx
7. Boot from macOS Base System
8. Now the macOS installer will load. Select Disk Utility and format the largest disk in the list.
9. Exit Disk Utility and and select Reinstall macOS
10. On restart, select macOS to continue the installation.
11. When the installation is finished, upon reboot select macOS to boot into macOS Catalina
12. That’s it finish setting up macOS Catalina and enjoy running macOS in a Docker container on your Linux machine.
To troubleshoot the installation as well as learn how to customize the build ( more RAM, more/less disk space, macOS version etc ) check out the project page here.