Emulating Mac OSX

Installation

Reference: https://github.com/kholia/OSX-KVM

 

Install qemu, set kvm params and clone the repo for OSX-KVM

sudo dnf install -y qemu virt-manager git wget libguestfs-tools 

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

git clone --depth 1 https://github.com/kholia/OSX-KVM.git

cd OSX-KVM
sudo cp kvm.conf /etc/modprobe.d/kvm.conf

Download a Mac OS to install. Do not pick Big Sur yet. Instead, pick latest Catalina.

./fetch-macOS.py
   #    ProductID    Version   Post Date  Title
   1    061-26578    10.14.5  2019-10-14  macOS Mojave
   2    061-26589    10.14.6  2019-10-14  macOS Mojave
   3    041-91758    10.13.6  2019-10-19  macOS High Sierra
   4    041-88800    10.14.4  2019-10-23  macOS Mojave
   5    041-90855    10.13.5  2019-10-23  Install macOS High Sierra Beta
   6    061-86291    10.15.3  2020-03-23  macOS Catalina
   7    001-04366    10.15.4  2020-05-04  macOS Catalina
   8    001-15219    10.15.5  2020-06-15  macOS Catalina
   9    001-36735    10.15.6  2020-08-06  macOS Catalina
  10    001-36801    10.15.6  2020-08-12  macOS Catalina
  11    001-51042    10.15.7  2020-09-24  macOS Catalina
  12    001-57224    10.15.7  2020-10-27  macOS Catalina
  13    001-68446    10.15.7  2020-11-11  macOS Catalina
  14    001-79699     11.0.1  2020-11-12  macOS Big Sur

  Choose a product to download (1-14): 13


qemu-img convert BaseSystem.dmg -O raw BaseSystem.img

qemu-img create -f qcow2 mac_hdd_ng.img 128G

To start the VM and install, run:

./OpenCore-Boot.sh

During the installation, go to Disk utility and Format the 128 GB disk and only then you can install.

To start the VM, use the following Shell script:

#!/usr/bin/env bash

sudo ip tuntap add dev tap0 mode tap
sudo ip link set tap0 up promisc on
sudo ip link set dev virbr0 up
sudo ip link set dev tap0 master virbr0

./OpenCore-Boot.sh

 

Important settings

1 - Change resolution:

Go to ​OpenCore-Catalina and find for 

cd OSX-KVM/OpenCore-Catalina
grep 1920 *

Change resolutions to something like

1600x900@32

Finally, change at Mac OS the resolution to what you want.

 

2 - Avoid freezing after a while when inactive

2.1 - Disable Screensaver

2.2 - At System Preferences, go to Energy Saver and set it to never Turn Off display. Then make sure you have enabled only the option: "Preventing the computer from sleeping ....."

 

3 - Super Key (Windows key) not behaving as mac Command key.

At qemu window, click on View, then enable "Grab On Hover"

 

4 - Create Snapshot

qemu-img create -F qcow2 -b mac_hdd_ng.img mac_hdd_ng_1.img

Update OpenCore-Boot.sh to call the new img file