Howto macOS sonoma kvm

From Vidalinux Wiki
Jump to navigation Jump to search

clone the git repo:

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

kvm need this tweak on the host machine to work:

echo 1 > /sys/module/kvm/parameters/ignore_msrs

make this change permanent, you may use the following command:

sudo cp kvm.conf /etc/modprobe.d/kvm.conf  # for intel boxes only
sudo cp kvm_amd.conf /etc/modprobe.d/kvm.conf  # for amd boxes onlyn

add user to the kvm and libvirt groups:

sudo usermod -aG kvm $(whoami)
sudo usermod -aG libvirt $(whoami)
sudo usermod -aG input $(whoami)

fetch macOS installer.

./fetch-macOS-v2.py

select option 7 for sonoma:

1. High Sierra (10.13)
2. Mojave (10.14)
3. Catalina (10.15)
4. Big Sur (11.7)
5. Monterey (12.6)
6. Ventura (13) - RECOMMENDED
7. Sonoma (14)

Choose a product to download (1-6): 7

convert the downloaded BaseSystem.dmg file into the BaseSystem.img file:

dmg2img -i BaseSystem.dmg BaseSystem.img

create a virtual disk image where macos will be installed:

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

edit OpenCore-Boot.sh and change ALLOCATED_RAM:

ALLOCATED_RAM="8192"

edit OpenCore-Boot.sh and change installation media controller to virtio:

#-device ide-hd,bus=sata.3,drive=InstallMedia
-drive id=InstallMedia,if=none,file="$REPO_PATH/BaseSystem.img",if=virtio,format=raw

edit OpenCore-Boot.sh and change sata for virtio in the following line:

-drive id=MacHDD,if=none,file="$REPO_PATH/mac_hdd_ng.img",if=virtio,format=qcow2
#-device ide-hd,bus=sata.4,drive=MacHDD

edit OpenCore-Boot.sh and add serial none line:

 -monitor stdio
 -device vmware-svga
 -serial none

before installation make a copy of OVMF_VARS.fd:

cp OVMF_VARS.fd OVMF_VARS.fd.bk

run the script to launch the installation:

./OpenCore-Boot.sh

references