My Journey to Make MacOS Run On ANY PC

Craig Chen
3 min readMar 9, 2020

--

To begin with today’s topic, let’s watch a video first:

From: Linus Tech Tips on YouTube

The idea behind running MacOS on any PC is that

we are able to boot MacOS on virtual machine and that virtual machine can run on any PC equals to MacOS can run on any PC.

This article is about my experience on how I made MacOS run on my PC and how I resolved some related issues. Please follow the steps on The Passthrough Post website.

Step 1: New and Improved Mac OS Tutorial, Part 1 (The Basics) — Install MacOS on VM

Step 2 (Optional): Mac OS VM Guide Part 2 (GPU Passthrough and Tweaks) — Enable GPU on VM

Step 3 (Optional): Edev Passthrough Keyboard and Mouse — Passthrough keyboard and mouse that can be used on both host and VM at the same time

Step 4 (Optional): Prepare for Apple ID

Step 5 (Optional): USB Passthrough (From UNRAID forum) — Passthrough USB controller enables the ability to of USB slot on VM, and resolves USB port (NOT ENOUGH) issue.

Debug Journey

After following the instructions on the above websites, I encountered some errors and these errors were not very straightforward for a VM newbie like me. Therefore, I want to share my search results to help someone struggling with the similar issues.

Error 1: vfio: error group X is not viable, please ensure all devices within the iommu_group after Step 2.

Solution: Make sure every device in different iommu group

  1. Check iommu group to see if every device is in different group with this script or simply enter ls /sys/kernel/iommu_groups/*/devices in the terminal. In this case, there should be several devices in one iommu group.
  2. Make sure ACS is enabled in bios. Install and boot ACS kernel patch. Then, every device should be in different groups. If not, proceed to the next step.
  3. Add pcie_acs_override=downstream,multifunction in /etc/default/grub under GRUB_CMDLINE_LINUX section. Reboot. This method is overkilled. Please refer to the following video for how to properly setting pcie_acs_override parameter.

I found a good video explaining about the theory behind Passthrough, PCIe, and IOMMU Groups.

From: Spaceinvader One on YouTube

Error 2: Host UI freezes when virtual machine is booted after Step 2.

Solution: Make sure the passing through GPU is using the correct kernel — vfio-pci.

  1. Enter lspci -vnn in the terminal to see if the GPU is using vfio-pci kernel.
  2. Edit /etc/modprobe.d/vfio.conf configuration with options vfio-pci ids=1002:67df (1002:67df is your GPU id which we can find by entering lspci -nkk | grep "VGA\|Audio")
  3. Enter cat/sys/bus/pci/devices/0000:0b:00.0 /modalias to get the modalias id for GPU with PCI ID 0000:0b:00.0 which we can find by excuting this script
  4. Update initramfs by entering update-initramfs -u -k all
  5. Reboot and check again with lspci -vnn

Reference: QEMU Virtual Machine PCIe Device Passthrough Using vfio-pci

Error 3: Could not open /dev/input/by-id/… Permission Deny when launch virtual machine after Step 3.

Solution 1: Change /dev/input/by-id/… to /dev/input/evnet…

  1. Enter ls -l /dev/input/by-id in terminal to see the connecting event with corresponding device
  2. Replace every /dev/input/by-id/… with corresponding /dev/input/evnet… in /etc/libvirt/qemu.conf file and virsh edit [your VM] configuration.

Side effect: The event may change whenever the system is reboot. Therefore, it is better to keep /dev/input/by-id/… if available.

Solution 2: Add parameter in /etc/libvirt/qemu.conf file

  1. Add security_driver="none" in /etc/libvirt/qemu.conf file
  2. service libvirtd restart and reboot

Finally, everything is working smoothly.

Thanks for every resource that I referenced in this article for resolving all my issues. Hope this information solve your issue as well.

--

--

Craig Chen
Craig Chen

Written by Craig Chen

Quantitative Analyst / Data Scientist

No responses yet