1. Convert to ISO image
First we need the MacOS Mojave image.
Download the official only on the Mac
Follow the link: support.apple.com/macos/mojave
You will transfer to iTunes, agree with the license agreement, remove all the checkboxes about the update, and choose to download the image.
After the download is complete, you need to convert the downloaded image into ISO, for this we will download the repository:
git clone https://github.com/kholia/OSX-KVM.git
And run the script:
Upon completion of which, the converted ISO image will appear on the desktop.
2. Host machine preparation
To run MacOS Mojave, you need a processor with support for sse4.1 and sse4.2 instructions
All actions were performed on OS Ubuntu 18.04, CPU: Intel Xeon E3-1270 v6
Make sure the processor supports virtualization:
egrep -c '(vmx|svm)' /proc/cpuinfo
If the match is "0" - does not support, if non-zero, it supports.
Enable forwarding packages:
Add a line:
Apply the changes:
Install all necessary packages:
apt install -y qemu qemu-kvm libvirt0 virt-manager bridge-utils libvirt-daemon-system libvirt-clients uml-utilities libguestfs-tools
Create interface "tap0"
ip tuntap add dev tap0 mode tap ip link set tap0 up promisc on brctl addif virbr0 tap0
Now on the host machine we also need the following repository:
git clone https://github.com/kholia/OSX-KVM.git
Copy our ISO image directly to the root of the downloaded repository.
Create a disk for a future virtual machine:
qemu-img create -f qcow2 mac_hdd.img 128G
3. Installing MacOS Mojave
We are interested in the script "boot-macOS-Mojave.sh" in the root of the repository
Correct the name and, if necessary, the path to the ISO image. Since we have Ubuntu without a graphical shell, we need to add the following options for forwarding an image via VNC:
-vga std -nographic -vnc :1
Where 1 - screen numbers, 1 - corresponds to port 5901. Counting from zero.
And delete the line: "-monitor stdio"
To get the following:
qemu-system-x86_64 -vga std -nographic -vnc :1 -enable-kvm -m 3072 -cpu Penryn,kvm=on,vendor=GenuineIntel,+invtsc,vmware-cpuid-freq=on,$MY_OPTIONS\ -machine pc-q35-2.11 \ -smp 4,cores=2 \ -usb -device usb-kbd -device usb-tablet \ -device isa-applesmc,osk="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" \ -drive if=pflash,format=raw,readonly,file=OVMF_CODE.fd \ -drive if=pflash,format=raw,file=OVMF_VARS-1024x768.fd \ -smbios type=2 \ -device ich9-intel-hda -device hda-duplex \ -device ide-drive,bus=ide.2,drive=Clover \ -drive id=Clover,if=none,snapshot=on,format=qcow2,file=./'Mojave/Clover.qcow2' \ -device ide-drive,bus=ide.1,drive=MacHDD \ -drive id=MacHDD,if=none,file=./mac_hdd.img,format=qcow2 \ -device ide-drive,bus=ide.0,drive=MacDVD \ -drive id=MacDVD,if=none,snapshot=on,media=cdrom,file=./'Mojave.iso' \ -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:AB:F8:B7
Run the script:
Connect via VNC to the port specified in the startup script
Run the installation
Immediately after selecting the installation language, run "Disk Utility"
We look at the size of the disks, and we find that we created for the virtual machine.
Select "Erase" and set the section name
Close the "Disk Utility" and proceed to install the "Install MacOS"
We agree with the license agreement and choose the section for installation
Next, the installation process to paint it makes no sense.
After installing MacOS Mojave, turn off the virtual machine and remove from the script the lines connecting our ISO image as a DVD drive.
These 2 lines are:
-drive id=MacHDD,if=none,file=./mac_hdd.img,format=qcow2 \ -device ide-drive,bus=ide.0,drive=MacDVD \
4. Installing Clover on a partition with MacOS
This is necessary not to remove the extra image from the virtual machine, but to set up the system autostart, without the need to select the boot partition.
Start the virtual machine and select the 3rd item "Boot MacOS from MacOS"
MacOS - the name of the section that we asked when preparing the section (Erase)
Download Clover and run, we get the following error:
Click "OK" and go to "System Preferences" -> "Security & Privacy" and see our Clover, and the message that for security purposes it was blocked. Click "Open Anyway"
We reach the point "Installation Type" and do not click "Install", but go to "Customize".
Mark the top two points for EFI
Click "Install" and enter the user password
Clover installation is complete.
In essence, the Clover installation was needed in order to create a boot partition, and we’ll clone the contents of the "Clover.qcow2" section into it.
Download Clover Configurator and run. Just go to "System Preferences" -> "Security & Privacy" and allow the launch.
Select the "Mount EFI" section and see two EFI sections there.
disk1s1 - mounted, MacOS partition, we will clone Clover here
disk0s1 - not mounted, image section "Clover.qcow2", we will clone from here
Mount disk disk0s1 - "Mount Partition"
Go to the section "Clover Cloner". Make sure that the "Source" is the partition "disk0s1", and the "Target" - "disk1s1". Click "Clone".
After successful cloning, turn off the virtual machine, find the following lines in the startup script:
-device ide-drive,bus=ide.2,drive=Clover \ -drive id=Clover,if=none,snapshot=on,format=qcow2,file=./'Mojave/Clover.qcow2' \
And delete them.
We start again the virtual machine. If everything is done correctly, then we see our Clover
Boot from the section with MacOS. Open Clover Configurator again. Go to the "Mount EFI" section and see that there is now one partition, we will mount it.
In the lower left corner we find the icon with the name "Import Configuration". In "Locations", select "EFI" -> "CLOVER" -> "config.plist" and click "Open".
In the section "SECTIONS" select the item "Boot" and bring it to the following form.
In the lower left corner we find the icon with the name "Export Configuration" and click "Save" and reboot, when you turn on Clover will ask the partition from which it is loaded, select our section, all subsequent downloads it will be automatically loaded from it.
After that you can leave only the following files: