Skip to content

Instantly share code, notes, and snippets.

@franciscocpg
Last active December 13, 2022 17:13
Show Gist options
  • Save franciscocpg/346b95119370f363726cfd67449a879c to your computer and use it in GitHub Desktop.
Save franciscocpg/346b95119370f363726cfd67449a879c to your computer and use it in GitHub Desktop.
Install MacOS docker on arch

Installation

Install deps, configure kvm and reboot:

yay -S qemu libvirt dnsmasq virt-manager bridge-utils flex bison edk2-ovmf xorg-xhost

sudo systemctl enable libvirtd.service
sudo systemctl enable virtlogd.service

echo 1 | sudo tee /sys/module/kvm/parameters/ignore_msrs

sudo modprobe kvm

sudo reboot

Enable xhost:

xhost +

To make this change persistent you need to add it to your shell rc file. Eg:

xhost + >/dev/null

Run docker:

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

Follow the instructions on https://github.com/sickcodes/Docker-OSX#additional-boot-instructions (like below):

Additional Boot Instructions

  • Boot the macOS Base System

  • Click Disk Utility

  • Erase the BIGGEST disk (around 200gb default), DO NOT MODIFY THE SMALLER DISKS (if you can't click erase, you may need to reduce the disk size by 1kb) and close the window

  • Click Reinstall macOS

Whenever you see the message below, run docker restart macos to restart QEMU and continue the installation.

image

QEmu

After running QEmu, go to View menu and select Grab on Hover so the window meta key will work as the command Mac key.

Keyboard ABNT2

If you have a keyboard with ABNT2 layout, make sure you select the type as ANSI and not as ISO for all key to work properly. To do so, go to System Settings -> Change Keyboard Type and follow the instructions until you see the screen below:

image

Click Done to confirm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment