• Become a Premium Member for $25/year with no ads to improve your community experience.

GUIDE How to Install macOS on QEMU/KVM [Intel/AMD]

EliteMacx86

Administrator
Staff member
Joined
Jul 22, 2018
Messages
7,247
Motherboard
Supermicro X11SPA-T
CPU
Intel Xeon W-3275 28 Core
Graphics
2xAMD RX 580 8GB
OS X/macOS
13.x
Bootloader
  1. OpenCore (UEFI)
Mac
  1. Mac mini
  2. MacBook Pro
Mobile Phone
  1. Android
  2. iOS

How to Install macOS on QEMU/KVM [Intel/AMD]


Requirements

Following are the requirements for installing macOS on QEMU/KVM. Please ensure you meet the requirements before proceeding with this guide.

CPUIntel (VT-x)/AMD (AMD SVM) supported CPU.
SSE4.1 instruction set required for macOS Sierra and later. See Bypassing CPU requirements for more information
SS4.2 instruction set required for macOS Mojave and later.
AVX2.0 instruction set required for macOS Ventura+
6 Core or more. 8 or more is recommended.
Haswell and later is recommended.
macOS Compatible CPU. See Chromebook and Chromebox Compatibility for more information.
ARM CPUs are not supported yet.
MotherboardA Compatible Motherboard with VT-X/AMD SVM option in BIOS/UEFI.
Only Intel and AMD Chipsets are supported at the moment.
Memory16GB or more
Storage50GB of free space on the Linux Drive or a separate drive with 128GB or more capacity.
A separate Drive is usually recommended.
Operating SystemAny Modern Linux Distribution. e.g. Ubuntu 22.04 LTS 64-bit/Linux Mint/Fedora Linux/Arch Linux/Manjaro or later
SoftwareQEMU 7 or later
Vim Editor
ToolsOpenCorePkg
OCAT


This guide supports various Linux editions such as Fedora, Kali Linux

requires basic Terminal and command line skills

Install tools/genisomage

Use Disk Utiity to create the Virtual Image. The advantage of this method is that whenever you need to edit the contents of the EFI or the config.plist, you can just mount, edit and then attach it to the VM. No need to create a new disk image unlike TrueNAS or Proxmox, everytime you make any mistake in building the EFI for your hardware. QCOW2


Sonoma direct install/configure bypass installation or copy it manually

The basic hardware compatibility still applies for using macOS on VM.


different URLs have been provided below

Code:
#14.5
https://swcdn.apple.com/content/downloads/32/06/062-01946-A_0PEP7JHIWA/1pfs4xh22555dj51fkep7w06s4eiezh21p/InstallAssistant.pkg

Code:
#macOS Sonoma
https://swcdn.apple.com/content/downloads/32/06/062-01946-A_0PEP7JHIWA/1pfs4xh22555dj51fkep7w06s4eiezh21p/InstallAssistant.pkg

Code:
#macOS Sonoma (14.5)
https://swcdn.apple.com/content/downloads/32/06/062-01946-A_0PEP7JHIWA/1pfs4xh22555dj51fkep7w06s4eiezh21p/InstallAssistant.pkg


simply change the name of the macOS which you are installing

The VMs can be useful in cases, where you want to have multiple Operating Systems together and for beta testing as well.

CHAPTER : Enable Virtualization​

The very first step is to set up BIOS to have the Virtualization enabled on your system. This is because there are a few systems that have the option to Enable/Disable the Virtualization in BIOS which affects the functionality when running a Virtual Machine. To enable Virtualization, follow the steps below.

1. On your target computer, boot to BIOS. Refer to your user manual for the BIOS Key
2. Enable Virtualization. This is usually present as Intel VT-x or Intel Virtualization Technology and AMD-V option in BIOS.
3. Save & Exit Setup.

STEP 2: Verify Virtualization Status​

The next step is to verify whether the virtualization is enabled or not. This step is required in order to ensure you're on the right track and you meet the hardware requirements to run a Virtual Machine. To verify the Virtualization status, follow the steps below.

1. Open Terminal and execute the following command:
Bash:
egrep -c '(vmx|svm)' /proc/cpuinfo

If the Virtualization is supported on the target system, the output should be greater than 0.

If you notice that the Virtualization is Disabled, you need to configure the BIOS/UEFI and enable Virtualization. Enabling the Virtualization Technology feature differs from vendor to vendor and the options differ between Intel and AMD. See STEP #1 for more information.

Verify/Check KVM Virtualization
Open Terminal and execute the following command to install cpu-checker package
Bash:
sudo apt install cpu-checker -y
Bash:
kvm-ok

Now that we have verified that our system supports KVM Virtualization, let us proceed and install QEMU.

Install QEMU/KVM

Before you begin to install QEMU, ensure you're using the latest version of the Linux distribution. If not,

This step may need to be adapted for your Linux distribution.

2. Update the system package list using:
Bash:
sudo apt update

Open Terminal and execute the following command

Bash:
sudo apt install qemu-system
When prompted, enter your password.
When prompted, type Y and press enter key

Assuming the Terminal Window is still open/running, install virt manager using
Bash:
sudo apt install virt-manager
When prompted, type Y and press return key

Once virtmanager is installed, enable it using
Bash:
sudo systemctl enable --now libvirtd

Now start virtmanager using
Bash:
sudo systemctl start libvirtd

You can check the status of virtmanager using
Bash:
sudo systemctl status libvirtd

You should find Virtual Machine Manager under Apps.

Add permissions
Bash:
sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER
sudo usermod -aG input $USER

Close Terminal
Restart your system!

Enable XML Editing

Some of the options cannot be changed directly and to change those, you need to manually edit the XML files. As the XML needs to be edited after creating the VM, it's advised to enable the XML editing for latter use. By default, the XML editing is disabled.

1. From Virtual Machine Manager, click on Edit and then select Preferences.
2. Select Enable system tray icon. Whenever you'll want to use Virtual Machine Manager, you can open it directly within one click from the system tray icon instead of opening it from Apps.
4. Select Enable XML editing
5. Click on Close

CHAPTER X: Creating Virtual Machine

Open Virtual Machine Manager from Apps.
Click on the icon at the top left corner to launch the Virtual Machine creation wizard. A new dialogue box will appear to add the Virtual Machine.
A Window will pop up. From there, select Manual install.
Set Architecture to x86_x64 under the Architecture options and click on Forward.
Now its time to define the Operating System we are going to install. As KVM does not have option for macOS, type macOS and when prompted, select Generic or unknown OS from the given list and click on Forward.
Set the Memory as 8192MiB. If you have enough memory on the host system, 16248MiB would be preferred. The least would be 8192MiB or 8GiB. For the best performance, 16GiGB or more is recommended.

NOTE: Due to some unknown reasons, the macOS will not boot with less than 8192MB memory.

Set the CPUs to no more than half of the Threads available on the host computer. The virtual core allocation should be always under 50% of the actual physical CPU Cores. Allocating more than 50% of the physical core may slow down the host computer (e.g. i5-10400 is a 6 Core CPU which has 12 Threads so allocating 6 Virtual Cores is under the 50% utilization limit).
From the storage options, select Select or create custom storage and click on Manage.
A window will pop up to browse the image. Click on Browse Local and select the Virtual USB Disk.img you created earlier in STEP #X. Once selected, click on Open and then click on Forward.
Specify a name for your Virtual Machine. For instance, we'll be using macOS. You can use any name.
Select Customize configuration before install.
Review the summary and click on Finish. If you notice that the parameters are not set as recommended, you can still edit the options and then review the Summary and click on Finish.

CHAPTER X: Configure Virtual Machine Parameters

Now before you can start the Virtual Machine and proceed with the macOS installation, you'll need to configure a few parameters in order to boot the macOS installer.
In order to boot the macOS installer, you still need to configure the Virtual Machine Parameters. To configure the Virtual Machine Parameters, follow the steps below.

Configure Hypervisor

In order to boot the OpenCore, you'll need to disable Secure Boot. By default, the Secure Boot is enabled for security purposes. Follow the steps below to disable Secure Boot.

By default, the Chipset and Firmware is set to i440FX and BIOS respectively, which can be fine for a few Operating System and will work fine with no problems. However,

If you want to describe your Virtual Machine, you can enter a description. We'll be using macOS Sonoma for instance.

1. Set Chipset as Q35 and Firmware as UEFI x86_64: /usr/share/OVMF/OVMF_CODE_4M.fd and click on Apply.
2. Click on Begin Installation and Virtual Machine Manager will create a new Virtual Machine with the parameters you choose. A Virtual Machine should appear in the list of Virtual Machines in the Virtual Machine Manager.
3. The VM will be started immediately. Click on down arrow key just left to the power button and select Force off to shut down the Virtual Machine. We still need to configure the Virtual Machine, before you can begin installing macOS.

NOTE: This setting cannot be changed once set.

Configure Network

The Network settings specify the Network Adapter type, MAC Address and the physical network interface for the VM. macOS already includes VirtIO drivers.

Select NIC: XX:XX:XX from the left pane.
Set Network source as Virtual network 'default': NAT from the drop down list.
Set Device model as Virtio from the drop down list. By default, its set as e1000e.
The Mac Address will be automatically generated by default and there shouldn't be a need to change it. You can change it later on by editing the XML file, if required.

Configure Storage

Now that we have added the Boot Disk during the VM creation/ at the time of creating VM, we need to create Virtual Disk for the macOS installation.
Click on Add Hardware
From the Storage pane, the default option will be selected
Set the size to 50GiB. You can change the capacity as per your needs. 50GB should be enough to install macOS and keep some files. The drive capacity can expand upto the max size you select here so please keep that in mind. macOS requires minimum 35GiB for the installation. Although the storage size is different for the different macOS versions, on an average, 35GB is minimum requires approximately.
Set Bus type as VirtIO
Click on Advanced options and set Cache mode as unsafe and then click on Finish. A VirtIO disk will be added to the VM.

Configure USB

By default the USB is set as USB 2.
Set Model as USB 3 and click on Apply.
Click on the XML tab just right next to the Details tab.
Set port count as 7 instead 15

Configure QEMU Parameters
Although the VM is ready to start, you need to add some parameters as it's required for macOS to ensure the installation is seamless, hassle free. At this point, other OS can boot normally

Lastly, you will need to configure some of the QEMU parameters.

CHAPTER : Installation


Yes, you have waited for a long and its time to nstall macOS now. Excited?

Once everything is set, you're ready to clean install the desired macOS version on KVM/QEMU. Please note that the host computer must be connected to the internet in order to install macOS since the BaseSystem is merely a recovery image and a full macOS installer will be downloaded during the installation. The Operating System is approximately 12GB in size. So if you're using any sort of Mobile Data make sure you have sufficient data, if using a Mobile Data plan.

Installing macOS on a shared Drive​


1. Open Virtual Machine Manager App.
2. Select the Virtual Machine you just created and click on ▶ to power on the VM.
3. The installer will load in a while and you'll see the progress with the Apple logo with a progress bar.
4. When at the Recovery screen, select your preferred language and continue.
5. Select Disk Utility and click on Continue.
6. When in Disk Utility, click on View, and then select Show all Devices.
7. Select Apple Inc. VirtIO Block Media and use the following parameters to erase the drive:

Name: Macintosh HD
Format: APFS
Scheme: GUID Partition Map

NOTES:
  • The target disk/partition must be GUID
  • APFS format is recommended for High Sierra and Later
  • Users who plan to use High Sierra on HDD should use macOS Journaled (HFS+) Format instead of APFS Format.

Installing macOS using Offline Method
Installing macOS on a dedicated separate drive requires SATA/NVMe passthrough. If you plan to go with that route, you'll have to configure the SATA/NVMe passthrough first. Please note that the NVMe limitations may apply as per the motherboard specification due to the number of PCIe lanes. In addition, multiple NVMe(s) can be added, however, for a SATA passthrough, you'll need a separate SATA Controller other than the Motherboard's built-in one. If you're using a Motherboard which has more than one SATA Controller, you can use SATA passthrough.

1. From the ESXi Host Client, select Manage.
2. Select the Hardware Tab and then select PCI Devices.
3. Select the target NVMe and click on Toggle passthrough to enable the passthrough
4. Select the target Virtual Machine in the left pane and click on Edit.
5. Remove the Hard disk 1.
6. Click on Add other device and then select PCI device from the drop-down menu.
7. From the New PCI device section, select the target NVMe from the drop-down list and click on SAVE.
8. Continue with the step #1 as mentioned above. For step #6, just select the target NVMe Disk.


NOTES:
The target disk/partition must be GUID
APFS format is recommended for High Sierra and Later
Users who plan to use High Sierra on HDD should use macOS Journaled (HFS+) Format instead of APFS Format. Users who are attempting to install macOS Sierra and prior, should use HFS+. Either way, APFS will not be available for macOS High Sierra and newer.

8. Once the drive is erased, close Disk Utility.
9. Select Reinstall macOS Sonoma and continue with the options.
10. Now select Macintosh HD and click on Continue.

NOTES:
  • Step #8 will format the target disk. Proceed with caution.
  • This will take a couple of minutes and will restart at "Less than a minute is remaining". Upon completion, the system will automatically restart. Your Mac will restart to complete the installation.

Here it ends the first phase of the installation.

When the installer reboots, the installer screen will appear and continue the second phase of the installation. During this phase, the installer will install files to your target disk and create a Recovery HD partition. Upon completion, your Mac will automatically restart.

STEP 3: Finishing macOS Setup​

After several minutes of waiting and keeping yourself patient, you should see the macOS setup screen. Now it's time to set up the macOS for the first usage with the newly installed macOS.

When you're at the welcome screen, continue with the basics options such as Keyboard setup, Network, Computer Account, and Privacy settings. Do not sign in to Apple ID when prompted.

Now the installation is complete! You should be logged in to your Desktop. For newer versions, unless the Graphics acceleration is enabled, it will be all white.

NOTE:
  • The macOS performance might be slow during the initial setup as the KVM/QEMU is not optimized yet.

Take Snapshot
Once you complete the macOS setup, it would be good to take a snapshot. If anything breaks during configuring the macOS or while testing out a few things or if the Virtual Machine goes corrupt, you can always head back to the snapshot to restore your previous installation using the Snapshot feature.

1. Select Take Snapshot... from VM>Snapshot menu.
2. Give a desired name to your Snapshot and click on Take Snapshot. You can also add the description to remember the state of the Virtual Machine.

When needed, you can restore the Virtual Machine to a previous working state from VM>Snapshot>Revert to Snapshot option. You can view all the Snapshots and their details using Snapshot Manager or using the shortcut CTRL+M.

If you want to use Snapshots feature, use QCOW2. However, please note that the speed of the QCOW2 disk may detoriate over the period of time.

NOTES:
Snaphosts require at least one writeable qcow2 disk image allocated to the guest.
Snapshots are only supported if all writeable disks imags allocated to thw guest are qcow2 format.

CHAPTER : Post Installation​

Although, a bare metal installation might have several things working if you have followed the guide precisely, however, this is not the case with KVM/QEMU. A macOS VM involves a lot more post-install steps such as PCI passthrough by which you can gain the advantage of Graphics acceleration and such. Only a few basic things will work (such as network) and a lot of function and hardware support will lack until you fix them using the post-installation steps covered in this guide, starting with the power management.

The post installation has been divided into two sections: (i) Basics; and (ii) Advanced, covering various aspects of the post installation steps.

Auto Start macOS VM

If you want to make the macOS Virtual Machine start automatically, when the host physical machine boots, you can configure such options with the KVM/QEMU. Follow the steps below to auto start macOS VM at power on

1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
2. From the left pane, select Boot Options.
3. Select Start virtual machine on host boot-up and click on Apply.

Now every time you start the Host machine, the macOS VM will be automatically started. This way, after the Graphics passthrough, the experience will be almost the same as the bare metal :)

Install OpenCore to the ESP/Boot without Virtual USB

Booting from the system drive without the use of Virtual USB Disk is one of the important parts of the post-installation. By booting directly off the macOS disk, the boot time is usually faster. To boot macOS without the use of USB, follow the steps below.

1. Mount the EFI Partition of your macOS Disk.
2. Open the EFI mounted on the Desktop.
3. Copy the EFI folder to the ESP you just mounted.
4. Once copied, unmount the EFI Partition of your macOS Disk. You can also eject the partition to unmount it.
5. Shut Down.

Now you can start the Virtual Machine without the Virtual USB Disk!

Remove OpenCore Recovery Disk

The Virtual USB Disk is same as physical USB disk and we can't always start with a USB disk every time we boot up the computer. This is not elegant at all and neither it is convenient for us to modify and customize the Virtual disk image everytime you need to make a change in the EFI. In addition, it can increase boot times. Therefore, once the OpenCore is installed to the ESP, it can be removed. The original Virtual USB disk can be used at any time if you encounter issue with the ESP or unable to enter the system for any reason or for the purpose of reinstalling macOS.

1. Shut Down the macOS VM.
2. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
3. From the left pane, select VirtIO Disk 1 and click on Remove. A new dialogue box will appear to confirm delete the Disk Device.
4. When prompted, uncheck Delete associated storage files and click on Delete.
5. Click on Apply. The VirtIO Disk 1 should be removed now.

You can now start the VM and edit the EFI directly from the ESP, just like a bare metal machine:

NOTES:
  • You must install OpenCore prior to removing OpenCore Recovery Disk
  • Do NOT delete the OpenCore Recovery Disk as it might be needed when you cannot/fail to boot/if the VM fails to boot for any reason after the modification in the ESP.

To manage the physical host machine wihout any Desktop/monitor connected/to manage seamlessly, you can install a WebGUI to manage the host with more ease.
However, you may further accelerate and improve the macOS performance using VMware Tools after installing it on the guest OS. This will give you the ability to use macOS in full screen.

To further accelerate and improve macOS performance and for a seamless experience, see Chapter for tuning KVM/QEMU.

Part 2

I. Power Management


Unlike the bare metal, the power management matters for VM and has the same importance.

How important the power management is on bare metal, it has the same importance even when running macOS inside Virtual Machine. After all, it helps to achieve the highest available performance when at peak load and consumes less hardware resources when idle to save power.

Luckily, with macOS Monterey and above, the Power Management is native and the Sleep/Wake, Restart and Shut Down functions perform normally. However, if you're on Big Sur or prior, you'll likely need to inject the SSDT (SSDT-PLUG or SSDT-PM) in order to enable the Power Management on the VM.


CPU. macOS


Sleep/Wake

The sleep/wake function slightly differs on VM as compared to Bare Metal. When you run the guest OS on a Virtual Machine the host system has to be turned up all the time. As the VM is running under a Host OS (Ubuntu), the machine itself cannot enter sleep mode. However, the VM does have capabilities to sleep, restart and shutdown. This can be easily observed/checked using System Monitor within Ubuntu.

It is quite surprising that KVM actually supports Sleep/Wake and works as expected for macOS. When in Sleep mode, you can wake up the macOS VM using the Mouse and/or Keyboard. During the sleep mode, the disk will read, write, and store the data. At this time, when using the Virtual Machine Manager, you can see that the CPU is still working at a very low frequency (13MHz) which indicates the guest OS has a working sleep function. However, the monitor and peripherals are turned off during the sleep mode. It is indeed the same as real sleep on bare metal just the host machine has to be turned on all the time, and is the only difference.

An unusual thing which we noticed is after returning from sleep/wake, the CPU usage is quite high and reaches like above 90% and hits 95% usage. However, within a few minutes, the CPU usage returns to normal state. Please note that this is not always the case and happens rarely.

Restart

The restart function works normally as bare metal. You can restart using Apple Logo>Restart or using the Restart button from TrueNAS Host (UI). However, it is always recommended to restart from the macOS to avoid data loss.

Shut Down

Like the restart function, the Shut Down also works normally as of bare metal. You can either shut down using the Apple Logo>Shut down or via the Power off button from the TrueNAS Host (UI). However, it is always recommended to perform a clean Shut Down within macOS to avoid data loss.




The Sleep/Wake, Restart and ShutDown function works normally as bare metal.
works with no issues
works normally as it should

Within macOS. You just have to be a little patient when performing these power related tasks. Sometimes, it can more time than expected.


Server/Workstation grade components offer the flexibility to add more devices and generally have more room for expansion and is power horse.


Although its highly recommended to setup PCI passthrough during post install/installation stage. However, few advanced user may prefer to set it up before installing macOS and that's completely fine as it gives you a real smooth experience.


The Ethernet supports Hotplug like bare metal.


Can i setup Virtualization on a single GPU?
Although, its recommended to use two GPUs (IGPU and dGPU), IGPU for the host and dGPU for the guest, you can still setup Virtualization using a single GPU, provided that its compatible with macOS.

The reason why you want to have two GPUs is because you would want to operate the Host OS on the machine and without a display attached, you cannot even create a VM. However, to overcome this issue, you can use WebUI and everything can fly/easy peasy.

CHAPTER X: PCIe Passthrough​

The real adventure begins/starts here ;)

Storage Passthrough

There are ideally 3 ways to passthrough a storage device to the macOS VM which are described below:

Controller Passthrough

By attaching the physical disk (NVMe/SATA/SAS SSD/HDD) to the dedicated controller (NVME/SATA/SAS/U.2) you are able to isolate it, no other disks in use by the host are connected to this controller. Bind this particular controller to vfio and use it in macOS VM. This will passthrough both, the controller and the disk (and everything thats attached to this controller), if not in use by the host. This is the most preferred way to passthrough a physical disk along with the controller to the VM, has high performance and is highly recommended. You can call it a real passthrough with no layers in between and the device will act same as in bare metal. In addition, for devices like SATA and/or NVMe, a full set of native functions will be supported such as TRIM, Secure Erase, command queing, etc. This will also bring the real performance and whatever speeds the controller and the disks supports with no limitations on the macOS VM.

Physical Disk Passthrough

For any reason, you are not able to isolate the physical disk (NVMe/SATA/SAS SSD/HDD) and the physical disk (NVMe/SATA/SAS SSD/HDD) is attached to a controller with something else in use by the host. Then, pass the disk with by-id, this will create an emulated controller and use the NVMe disk under macOS VM. This is the second preferred choice and does not hurt the performance, faster than SATA. This option should only be used if you're unable to use the first option.

Virtual Disk Passthrough

For any reason, you are not able to isolate the physical disk (NVMe/SATA/SAS SSD/HDD) and the physical disk (NVMe/SATA/SAS SSD/HDD) is attached to a controller with something else in use by the host. Then, create a vdisk (virtual disk) on the physical disk (NVMe/SATA/SAS SSD/HDD); this will create an emulated controller and use the vdisk on NVMe/SATA/SAS SSD/HDD under macOS VM. This is the last option if you cannot use either of the two above options. You can call it shared drive. You can still store the VM related files and also use it under VM, a portion of it. The disk performance is not bad, provided that you are using NVMe/as long as you are using NVMe for the Host OS.

SATA Passthrough

VirtIO Passthrough

NVMe Passthrough

Please note that you cannot passthrough the disk being used by the host and/or specifically the disk on which the host OS is installed. Doing so will cause/result in immediate crash as soon as you start the macOS VM.

I/We know you all are excited for the passthrough and have waited with so much and are eager to start with the passthrough guide. but let's start with the basic passthrough

HBA and Fiber Channel Passthrough
Although there are not much options and support is limited under macOS, HBA and Fiber Channel is supported but the support is limited. Luckily, if you have such requirements, you can easily passthrough it.


Thunderbolt Passthrough

IGPU passthrough
dGPU passthrough
- AMD
- NVIDIA

GPU Spoof

USB Passthrough

By default, the USB support is absent and does not work under macOS VM and it is not shared either. Unless you set up a USB passthrough, you can only use the Keyboard and Mouse via Console. There are ideally 2 ways to passthrough a USB device to the macOS which are described below. You can either individually passthrough either each USB device to the macOS VM or the whole USB Controller (XHCI/EHCI/UHCI) to the macOS VM in KVM/QEMU. It's quite flexible and you don't have to install a USB PCIe Card just to use USB peripherals (including BT) on a macOS VM. Choose one of the methods as per for your preference

USB Controller Passthrough

By attaching the physical (or onboard) USB devices to the dedicated controller (XHCI/EHCI/UHCI) you are able to isolate it, no other USB devices in use by the host are connected to this controller. Bind this USB Controller to the macOS VM in the form of PCI passthrough. This will passthrough both, the controller and the USB devices (and everything thats attached to this controller) and all the USB Devices connected on the host system will be available to the macOS VM at once. This will also bring the real performance and whatever speeds the controller and the USB devices supports with no limitations on the macOS VM. However, please be advised that once you start the macOS VM, you'll lose access to all the USB Devices on the physical host machine and all such Devices will be only available under the macOS VM. If you have multiple VMs, a separate USB Controller is required for the USB Passthrough for each VM. For systems with multiple USB Controllers, this can be very efficient as each VM can occupy one. This option should only be used if you're unable to use the second option.

1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
3. Click on Add Hardware. A new dialogue box should appear to add the New Virtual Hardware Devices.
4. Select PCI Host Device from the left pane.
5. Select the target USB Controller (XHCI/EHCI/UHCI) from the Device list and click on Finish.

You should see a new PCI Device listed under the Devices list.

After the USB passthrough, we can use the Keyboard and Mouse to operate the macOS Virtual Machine. When we enter the system, we also find that our all USB Devices can be recognized normally.

NOTES:
  • Once you start the macOS VM, you'll loose access to all the USB devices on the physical host machine connected to the controller you passthrough.
  • If your system has a single (XHCI/EHCI/UHCI) Controller, its highly not recommended to use this method as at certain times, you may need to use a USB Device while the macOS VM is powered on.
  • Unlike the bare metal, USB Mapping is required with the Controller passthrough.

Individual USB Passthrough

For any reason, you are not able to isolate the physical USB devices and the physical USB device(s) is/are attached to a controller with something else in use by the host. Then, passthrough the USB devices individually, this will create an emulated controller and use the USB device in macOS VM. You can have the USB Devices shared between the Linux Host and the macOS VM (not both at the same time), and a single USB Controller can share different USB Devices as per the need/requirement. With the macOS Virtual Machine, you would need a Keyboard, Mouse, and Bluetooth mainly. Moreover, you will not have to map the USB Ports under macOS and that's another advantage. This is the first preferred choice and highly recommended over the Controller passthrough.

1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
3. Click on Add Hardware. A new dialogue box should appear to add the New Virtual Hardware Devices.
4. Select USB Host Device from the left pane.
5. Select the required USB Device (typically Keyboard, Mouse, and Bluetooth) from the Device list you want to passthrough and click on Finish.

You should see a new USB Device listed under the Devices list.

Once you start the macOS VM, the Keyboard, and Mouse will start working within the OC menu. When we enter the system, we also find that our all shared USB Devices can be recognized normally. After the USB passthrough, we can use the Keyboard and Mouse to operate the macOS Virtual Machine.

NOTE:
  • The USB Passthrough supports Hotplug and you don't need to restart and/or shutdown the VM everytime you want to use a USB device in the macOS VM.
  • The USB device location may not be persistent across reboots and therefore you will have to remove the USB device again and set it up again.

IV. Network (NIC) Passthrough

The default network on the Linux Host (VirtIO) is driver-free under macOS as it is being shared. Depending on the NIC speed, the macOS will also have the same speed as the native NIC speed i.e. 1GbE, 2.5GbE, 5GbE, or 10GbE. There are ideally 2 ways to passthrough a NIC to the macOS VM which are described below. You can either share the network using a layer to the macOS VM or the NIC Controller itself to the macOS VM in QEMU/KVM.

Shared

As the Onboard NIC will be occupied by the host, you cannot pass through directly it to macOS as the Linux host will loose access to internet and if you are using WebGUI to manage the host, it can be a problem. In addition, it can be shared with some other IOMMU groups which can prevent the direct passthrough to the macOS VM. However, the NIC can be shared and can facilitate the internet function via DHCP configuration. Although the network is pre-configured during the time of configuring the VM, its demonstrated here again to ensure if you have missed it out, you can fix your internet.

1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
3. Click on Add Hardware. A new dialogue box should appear to add the New Virtual Hardware Devices.
4. Select Network from the left pane.
5. Ensure MAC address checkbox is checked.
6. Select virtio as Device model from the drop down list and click on Finish.

You should see a new Network Device listed under the Devices list.

NOTE: The MAC address is randomized automatically. If you want to use your own MAC address, you can use that too.

As the VT-d support is absent, its problematic for devices (such as I225-V) that requires VT-d support under macOS. As of now, the options are limited and the support is community based.


For a dedicated NIC passthrough, you'll need a separate NIC.

Provided that the NIC has its own separate IOMMU group and is not shared, you can passthrough the NIC directly to the macOS VM.

NIC Controller Passthrough

By attaching the physical (or onboard) dedicated network controller you are able to isolate it, the NIC is not in use by the host. Bind this NIC Controller to the macOS VM in the form of PCI passthrough. This will passthrough both, the controller and the devices (and everything thats attached to this controller) and all the devices connected on the host system will be available to the macOS VM. This is the most preferred way to passthrough a network controller and highly recommended for high performance networking (typically 10GbE or higher). You can call it a real passthrough with no layers in between and the network will have the same performance as in bare metal. In addition, for some of the high end network controllers, a full set of native functions will be supported such as RDMA, RoCE, iWRAP, NFS, ISCSI, etc. This will also bring the real performance and whatever speeds the controller and the end device is capable of, with no limitations on the macOS VM. This option should only be used if you have a separate physical NIC or(onboard) and that you're unable to use the first option and when you have to deploy 10GbE or above networking.


Unlike the other passthrough devices, the NIC passthrough also requires a separate IOMMU group and shouldn't be shared.

This option should only be used when (i) you have a separate physical NIC or(onboard) and that (ii) you're unable to use the first option and (iii) when you have to deploy 10GbE or above networking.

This option should be only used when:
You have a separate physical NIC or Onboard
The NIC has its own IOMMU group and is not shared
You are unable to use the first option and;
You want to use 10GbE or above networking

As the Onboard NIC will be occupied by the host, you cannot pass through directly it to macOS as the Linux host will loose access to internet and if you are using WebGUI to manage the host, it can be a problem. You'll need a separate NIC Card for the passthrough. However, the NIC can be shared and can facilitate the internet function via DHCP configuration. If you have a separate NIC, you can simply install it and enable the NIC passthrough. In case the host has multiple NIC(s), you can enable the passthrough with one of those.

1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
3. Click on Add Hardware. A new dialogue box should appear to add the New Virtual Hardware Devices.
4. Select PCI Host Device from the left pane.
5. Select the target NIC Controller from the Device list and click on Finish.

You should see a new PCI Device listed under the Devices list.

NOTES:
  • When doing a NIC passthrough, you'll need to install the required driver (.kext) under macOS if your NIC requires an additional driver for macOS, unless the NIC has native support (driver-free) under macOS (such as Intel I225-V). The driver can be obtained from the vendor's site or if the community has already a driver, you could use that. If the NIC requires Device ID spoofing, you'll have to spoof it using either DeviceProperties or SSDT which can be loaded via OpenCore.

When doing a NIC passthrough, you will need to install the required driver (.kext) under macOS if your NIC does not have a native support (driver-free) under macOS (such as Intel I225-V) and requires an additional driver for macOS.

unless the NIC has native support (driver-free) under macOS (such as Intel I225-V), you'll need to install the required driver (.kext) under macOS if your NIC requires an additional driver for macOS

Results:

10GbE/25GbE/40GbE/100GbE

As the Onboard NIC will be occupied by the TrueNAS Server/host, you cannot pass through directly it to macOS. You'll need a separate NIC Card for the passthrough. However, the NIC can be shared and can facilitate the internet function via DHCP configuration. Although the network can be shared using the VirtIO (driver name), you may wish to use the high-speed NIC or onboard (such as 10GbE), (if you have one) for fast file transfer sharing, and for that, you'll have to passthrough the specific NIC under macOS.

NOTE:
  • Due to the unavailability of VT-d under macOS as it is being used by the Linux Host, you cannot drive NICs which require VT-d. This includes several cards from Aquantia (AQC107, AQC113), Mellanox (ConnectX-4 CX4121A), and Intel (I225-V, X710, XL710), etc. For NICs like AQC107, luckily there is a Kernel Patch which can be injected via OpenCore and the NIC can be driven normally as you would on a bare metal machine.
Aquantia AQC107

1. Mount the ESP
2. Open the config.plist using OCAT
3. Add the following patch under the Kernel>Patch section of your config.plist. In addition, you'll need to specify the MinKernel to 23.0.0 to ensure that the kext is only loaded on macOS Monterey and above.

ArchIdentifier*CommentFindReplaceMaskReplaceMaskMinKernelCountEnabled
Anycom.apple.driver.AppleEthernetAquantiaAqtionCaseySJ - Fix alloc_dma_buffer (including Sonoma)4889C741 B8030000 004889C741 B8130000 00F8FFC7FF FFFFFFFF FF00000000 00100000 0021.0.03YES
Anycom.apple.driver.AppleEthernetAquantiaAqtionCaseySJ - Fix IOBufferMemoryDescriptor::withOptionsBA000000 00BF0000 0000BA000200 00BF1300 0000FFFF00FF FFFFF0FF FFFF00000000 00001000 000021.0.03YES

4. Save config.plist
5. Restart macOS

Aquantia AQC113

2.5GbE
Various 2.5GbE onboard ethernet such as (Intel I225-V/I226-V) can be passthrough easily using the AppleIGC.kext in macOS VM.

Similarly, AppleIGB.kext can be used for driving 1GbE based Intel Ethernet such as (I219LM). Although, the same can be achieved using IntelMausi.kext.

Although, it is highly recommended not to passthrough the onboard NIC (if you have a single NIC), you may wish to passthrough, considering you have a separate NIC for the Host.



See Network driving cards for more info.

The implementation is the same as AMD Systems as it lacks VT-d which is now a must requirement in order to drive several hardware under newer macOS versions (typically Monterey and later).

Results:


However, if the host machine/system has multiple ethernet controllers, its not a problem.

Please note that systems having a dedicated IPMI LAN port, do NOT passthrough it to the macOS VM as it will make the management more complex.

V. WiFi/BT Passthrough​

If you're using a WiFi/BT which has native support (driver-free) under macOS, the WiFi should work normally as it would on a bare metal install once you enable the WiFi passthrough. One of the reasons why it is recommended to use hardware that has native support under macOS. Following are the steps to enable WiFi passthrough under macOS:

1. From the ESXi Host Client, select Manage.
2. Select the Hardware Tab and then select PCI Devices.
3. Select the target NIC and click on Toggle passthrough to enable the passthrough
4. Select the target Virtual Machine in the left pane and click on Edit.
5. Click on Add other device and then select PCI device from the drop-down menu.
6. From the New PCI device section, select the target NIC from the drop-down list and click on SAVE.

Power On VM
Boot into macOS
You should see the NIC under macOS now

III. Bluetooth​

In order to utilize all the functions of a WiFi Card, WiFi alone is not enough. Bluetooth also needs to function. As Bluetooth is on USB protocol, you must passthrough the USB Controller/Devices so that we can add our Bluetooth Device to macOS. See USB Passthrough for more information.













SideCar
See Enabling SideCar for more information.

Time Machine


The idea is to keep the installation as close as bare metal. Unlike the AMD Kernel patches for the bare metal, KVM does not require any of those patches and with some of the change, the same Intel EFI can be used for AMD systems as well.

Another advantage with the KVM is, you can spoof the CPU within Virtual Machine Manager if you are running an unsupported CPU without the need to set CPUID in OpenCore config.plist. no longer required/need to set CPU ID.

You can use Client for Desktop CPUs and Server for HEDT and Server CPUs.

Please note that Penryn or other CPU configuration such as Haswell-noTSX will NOT work on AMD CPU

Low power/grade CPUs such as Celeron and Pentiums might work. However, due to less number of Cores, Virtualization on such CPUs are not feasible at all. This includes Laptops as well. Such hardware configurations are not supported and is purely experimental.

As only dGPU will be used, it makes more sense to use iMacPro SMBIOS.

One more good thing with KVM is, all the apps would normally here which use to crash on AMD.


Setting the CPU to Penryn will do the trick and you will be able to boot the installer. However, once macOS is installed, it will fail to boot fully and will get stuck before it reaches the Desktop!

GPU/Graphics Passthrough

WARNING: Once you reboot after this procedure, whatever GPU you have configured will no longer be usable on the host until you reverse the manipulation. Make sure the GPU you intend to use on the host is properly configured before doing this - your motherboard should be set to display using the host GPU.

Once the VM starts/you start the VM, you'll loose signal from your main display immediately and therefore your machine must have the main display set via IGPU/APU or the other dedicated Graphics Card, unless you're using WebGUI and you're pretty confident that you're used to Linux and can perform most of the tasks using the command line.

Sleep/Wake, Restart and Shut Down function works normally on AMD platforms as well.

Open Terminal
Add the following line to the

Append the following line to the


Offline Installation
Although its not possible to create offline Bootable USB from Windows or Linux the way its done on macOS.

More methods can be found here

See Booting macOS Installer on Desktops and Laptops using OpenCore for more methods

More methods are described in

Another advantage of this method is that, even for beta phase (such as Sequoia), you don't need to wait for final release to have the Recovery image and then a Recovery based Bootable USB can be created using Windows or Linux


Please note that USB passthrough will not work in the Spice Console. Unless you use a Graphics Passthrough, the USB Device won't attach.

The main essence of the passthrough is that the components in the machine or the devices you want to passthrough, must have its own IOMMU group. If not, everything will be tied to one group/if multiple devices are in one IOMMU group, this is going to be a problem and usually, when you passthrough such device, the system will crash. Finding a motherboard with its separate IOMMU groups is quite/can be quite difficult.


By default, the guide describes installing macOS on a Shared Disk on the host for the sake of simplicity/to keep things as simple as possible. See Storage Passthrough for more information


With the time, the NVMe are becoming popular choice amongst users. Although HDDs are used for bulk storage, the NVMes are being used as a primary storage device other than the boot disk, wherever possible. As NVMes are widely available for a decent price, we highly recommend setting up the Host and the guest OS on a NVMe disk for better performance and efficiency. HDDs are highly discouraged and can result in poor performance on the guest VM. We do NOT recommend such atleast for boot disk (either for Host or Guest OS). Please use such setup at your own risk!

SATA disks can still be used on both the sides (Host and Guest OS). However, when using the shared disk or a dedicated disk, the performance is nearly halved to/than its an actual performance the device is capable of. This is due to the layers in between and not the actual physical disk being passthrough. Provided that you are using NVMe on the host OS, the performance is decent and is not impacted that much. Its fast, easy.

The principle still applies here on the KVM side/even during virtualization as well.

those days are gone long ago when we used HDDs for the boot disks. Nowadays, a high performing NVMe is available for a decent price.

Storage Considerations
Unless you're using NVMe, the performance might be affected on the VM when using SATA/SAS SSD or HDD.

Is fast enough and you'll barely see any lags in the VM, provided that everything is as per the guide.

Virtualization Compatibility for macOS

Enabling macOS Specific Features

SideCar
App Store
iMessage/FaceTime

Note that selecting PCI devices presently in use by another guest causes errors.

Use only spare devices which are not in use by the host.

Dual/Quad Port Ethernet


CHAPTER 2: Creating macOS/OS X Virtual Bootable USB

If you determine that your hardware is compatible according to the above-provided compatibility lists, you can start your journey by creating a Bootable USB for your target computer.

I. Requirements
  • USB Flash Drive (16GB at least for OS X 10.11 and newer and 8GB for OS X 10.10 and prior).
  • Access to a computer with OS X/macOS installed (Offline Method)
  • Access to a computer with macOS/OS X or Windows or Linux installed (Online Method).
  • Internet connection to download the required files.

II. Making the Virtual Bootable USB

A macOS Bootable USB can be made either online or offline. Depending on your choice, select one from below

MethodNotes
Online
  • Online installers use a recovery image approx 700MB in size and once booted, the macOS is downloaded from Apple servers once installation starts.
  • Can be made in macOS/Windows/Linux
  • Requires a compatible Ethernet or WiFi setup and stable internet to download the macOS during the installation process
Offline
  • Offline installers are full installers.
  • Can be made in macOS/Windows/Linux
  • No internet required during the installation process

Now, depending on the Operating System you have, choose one of the below options to create the Bootable USB. You can skip this step and head to preparing the OpenCore EFI if you have already a Bootable USB with macOS Installer you wish to install on the target computer.

For macOS users


For users with macOS computers, there are two methods available which are described below. Depending on your preferences, choose one of the methods described below. For users with macOS computers, we recommend Offline Method for creating the Bootable USB.

I. Offline Method


Generally, the offline method is preferred for those users who have access to a fast internet (50-100Mb/s) usually. As the complete installer is downloaded beforehand, there is very less likely chances of installation failure to occur. Moreover, it's faster and usually takes less time than the online method. We highly recommend to use Offline method for a number of good reasons.

1. Downloading macOS (10.13 and newer)

(a). Method #1: Using App Store


If you're running OS X El Capitan 10.11.6 or macOS Sierra 10.12.5 or later, you can use App Store Method to download the required version of macOS. However, this method is limited and will only allow you to download macOS High Sierra 10.13 and newer. For macOS Sierra (10.12) and older, see Downloading Legacy OS. Follow the steps below to download macOS High Sierra and newer using Mac App Store.

1. Depending on the macOS version you want to install, open the appropriate link given below using Safari. You can use other browsers as well (such as Chrome or Firefox). When using other browsers than Safari, click on Open App Store when prompted. This will open the App Store download page for the particular macOS. For the active macOS release versions, you can also directly go to App Store and download the desired macOS release and continue Preparing the installer.

Code:
macOS Sonoma (14.x)
macappstores://apps.apple.com/app/macos-sonoma/id6450717509?mt=12

macOS Ventura (13.x)
macappstores://apps.apple.com/app/macos-ventura/id1638787999?mt=12

macOS Monterey (12.x)
macappstores://apps.apple.com/us/app/macos-monterey/id1576738294?mt=12

macOS Big Sur (11.x)
macappstores://apps.apple.com/us/app/macos-big-sur/id1526878132?mt=12

macOS Catalina (10.15)
macappstores://apps.apple.com/us/app/macos-catalina/id1466841314?mt=12

macOS Mojave (10.14)
macappstores://apps.apple.com/us/app/macos-mojave/id1398502828?mt=12

macOS High Sierra (10.13)
macappstores://apps.apple.com/us/app/macos-high-sierra/id1246284741?mt=12
View attachment 5981
2. When the App Store opens, click on the GET button to begin downloading the macOS installer.

View attachment 5982
If you're downloading the macOS on a system running macOS Monterey or later, you'll see something like below. Click on the Download button to download the macOS.
View attachment 5989

Once you click on the Download button, the system will start downloading the required version of macOS.

View attachment 5991

3. Once the download is complete, the macOS installer will appear in the Applications folder and will open automatically.
View attachment 5992View attachment 5993

4. Quit the installer using Command+Q. When prompted, click on Quit.
View attachment 5994
For old versions of macOS (such as High Sierra), you may see a warning once the system finishes downloading macOS. Simply click on Quit as we'll have to create a Bootable USB instead of installing it on the same computer.

View attachment 5995



You can find the respective macOS Installer in the /Applications directory.

Verify the size of the downloaded installer by getting the installer's info. Usually, this should be near about 12GiB approx in size. This is required as sometimes the installer gets downloaded as an incomplete installer which can prevent booting the macOS/OS X installer.

2. Downloading macOS (10.7-10.12)

Using this method, you can download a complete installer, directly from Apple. However, this method is limited and will allow you to download OS X 10.7 to macOS 10.12 only. Follow the steps below to download OS X 10.7 to macOS Sierra (10.12). For macOS High Sierra (10.13) and later, see Downloading Modern OS. Follow the steps below to download macOS Sierra and prior.

QUICK INFO:
OS X 10.9 (Mavericks) isn't available with this method. If you're looking for OS X 10.9, see Online Method for more information.

1. Depending on the macOS version you want to install, download the required version by opening the link below. This will download a .DMG file.

Code:
macOS Sierra (10.12)
http://updates-http.cdn-apple.com/2019/cert/061-39476-20191023-48f365f4-0015-4c41-9f44-39d3d2aca067/InstallOS.dmg

OS X El Capitan (10.11)
http://updates-http.cdn-apple.com/2019/cert/061-41424-20191024-218af9ec-cf50-4516-9011-228c78eda3d2/InstallMacOSX.dmg

OS X Yosemite (10.10)
http://updates-http.cdn-apple.com/2019/cert/061-41343-20191023-02465f92-3ab5-4c92-bfe2-b725447a070d/InstallMacOSX.dmg

OS X Mountain Lion (10.8)
https://updates.cdn-apple.com/2021/macos/031-0627-20210614-90D11F33-1A65-42DD-BBEA-E1D9F43A6B3F/InstallMacOSX.dmg

OS X Lion (10.7)
https://updates.cdn-apple.com/2021/macos/041-7683-20210614-E610947E-C7CE-46EB-8860-D26D71F0D3EA/InstallMacOSX.dmg

2. Once the .DMG file is downloaded, double-click the .DMG file to open it and you'll see a .pkg file within.
3. Double-click the .pkg file and this will automatically move the macOS/OS X installer into your /Applications folder upon installing .pkg file. However, if you're on a new macOS/OS X version than the .pkg file you're installing, you'll receive the following error:

View attachment 5191

This is because the package checks for system compatibility, even if you're creating a Bootable USB for a different target computer. To fix this issue, you'll need to manually extract the installer from the .pkg file. Follow the steps below to extract the installer.

Extracting the Installer

(a). Method #1: Using App Method


1. Download the required macOS/OS X version using the guide above.
2. Download and install Pacifist.
3. Mount the .DMG file
4. Open the .pkg file using Pacifist and you'll see the following.


From the top, click on Package Resources, just next to Archive Contents and you'll see something similar to the following


Expand the InstallOS/Instal OS X Contents and you'll see something similar to the following


Right-click on InstallESD.dmg and select Extract to Custom Location and you'll see something like below


When prompted, select the location for storing the .dmg file and click on Choose

When prompted, click on Extract to begin the extraction process.


When prompted, enter your password and click on OK button.


Pacifist will start extracting the ESD file to your chosen location.


For both the Offline Methods described above, you can use the createinstallmedia command to create a Bootable USB.

Verify the size of the downloaded installer by getting the info of the Installer. Usually, this should be near about 8GiB approx in size. This is required as sometimes the installer gets downloaded as an incomplete installer which can prevent booting the macOS/OS X installer.

3. Hybrid: Downloading OS X Lion (10.7.5) and Later

Using this Hybrid method, you can download a variety of installers, including Beta installers. However, by default, Mist will not include Beta installer downloads, unless you explicitly allow it to download such. Using this method, you can download the current macOS installer as well as Legacy macOS installers such as macOS Sierra and prior (except for Mavericks (10.9) and Snow Leopard (10.6)) in one click. Moreover, unlike OCLP, Mist is also capable of downloading the macOS installers and has the ability to create the bootable USB for OS X Yosemite (10.10.X) and later. Follow the steps below to download OS X Yosemite (10.10.x) and later.

1. Download Mist
2. Once the .DMG is downloaded, double-click the .DMG file to open it.
3. Move the Mist to your /Applications folder
4. Open Mist.app to launch the Application

View attachment 6551
5. From the Menu bar, select Mist and click on Install Privileged Helper Tool. When prompted, enter your password and click on Install Helper.

View attachment 6562View attachment 6563
You can also install the Privileged Helper Tool from the Mist>Preferences
View attachment 6557

6. From the Menu bar, select Mist>Preferences and ensure the Privileged Helper Tool is installed.


View attachment 6558
7. In the same window, click on Check now to ensure you're using the latest version of the Mist. If there's an update available, install the update and check for the updates again to ensure you're running the latest version.

View attachment 6559
8. Click on OK and close the Preferences and you'll be back at the app.

By default, Mist will not include Beta installer downloads, unless you explicitly allow it to download such. This feature can be useful for downloading a version of macOS that is still in the Beta stage and has not been publicly released yet. Users who do not wish to download Beta Installer can ignore this step. Follow the steps below to download macOS Beta Installer.

1. Open Mist>Preferences and go to the Installers tab.
View attachment 6572
2. In the Software Update Catalogs section, select the type of Catalog i.e. Customer, Developer, or Public. You can either select them individually or can select all of them.

View attachment 6573
3. Close Preferences and you'll be back in the App. From the bottom, select Include Betas and then click on the Refresh button at the top, left to the Search menu and Mist will rescan the catalogs.

View attachment 6574View attachment 6575
Now, you should be able to see the Beta Installers in the download list.

View attachment 6576
4. Continue from the step #10

9. By default, the Mist will land on the Firmware download. Click on the Installers tab.

View attachment 6560View attachment 6561
10. Depending on the macOS version you want to install, click on the download button right next to the macOS version.
View attachment 6561
When downloading a legacy version of macOS, i.e. macOS Sierra and prior, you may get this warning. Simply click on Continue to proceed with the download.
View attachment 6577
NOTE: If the Privileged Helper Tool is not installed, you'll get the following error when you click on the Download button.

View attachment 6569
11. When prompted, select the desired location to download the macOS installer and click on Save
View attachment 6564
Once you click on Save, the Mist will start downloading the requested installer.
View attachment 6565View attachment 6566
Once the installer is downloaded, the Mist will save the installer in the particular location you chose previously and will also perform a cleanup.
View attachment 6567
Once tasks are completed, you'll see the tasks in green and you'll find the macOS Installer in the directory you chose earlier.
View attachment 6568View attachment 6571
12. Click on Close and Quit Mist.

4. Preparing Installer

Once you have obtained the desired copy of macOS Installer, you can prepare the installer. To prepare the installer, we'll use createinstallmedia command.

OpenCore and the macOS/OS X Installer are placed on separate partitions on the Bootable USB. There are two possible options for the USB partitions which are listed below. Depending on your choice, choose one of the methods to create the Bootable USB.

MethodNotes
MBR
  • MBR with a FAT32 partition for OpenCore.
  • Separate HFS+J partition for the macOS/OS X installer.
  • EFI Partition is always mounted automatically when the USB is plugged in.
GPT
  • GPT with a single HFS+J partition for the macOS/OS X installer.
  • Hidden EFI partition (automatically created).
  • Need to mount EFI Partition every time you want to access the ESP.


We recommend using MBR with two partitions as most of the computers can boot from it (including Legacy), and it is convenient that the EFI partition will mount automatically when the USB is inserted. This can be very helpful in case if you want to make any changes to the contents of the EFI Partition.

(a). Method #1: MBR

QUICK INFO:
Be careful with diskutil commands as you can lose data without a mechanism for recovery if you repartition the wrong disk.
If you're using OS X EL Capitan or prior, Disk Utility cannot be used for MBR partitioning.

1. Insert your USB Flash Drive
2. Open the Terminal and execute the following commands
Bash:
diskutil list

In our case, the output is


As you can see, the USB Flash drive is

To partition,
Bash:
diskutil partitionDisk /dev/disk1 2 MBR FAT32 "OpenCore EFI" 200Mi HFS+J "macOS Installer" R

You'll see the following as an output of the operation:

3. Quit Terminal

(b). Method #2: GPT

1. Insert your USB Flash Drive
2. Open Disk Utility. The Disk Utility is located at /Applications/Utilities.
3. Click on View and then select Show All Devices
View attachment 6028
4. Select your target USB Flash Drive in the left pane and click on Erase button, at the top and a popup will appear. Use the following parameters to erase your drive.

Name: USB
Format: Mac OS Extended (Journaled)
Scheme: GUID Partition Map
View attachment 5860
NOTE:
Do NOT use any other format other than Mac OS Extended (Journaled) to erase the USB.

5. When done, click on Done and close Disk Utility. You can click on Show Details to verify if the USB has been erased with HFS+ format.
View attachment 5861

6. Launch Terminal, located at /Applications/Utilities.
7. Depending on the macOS/OS X version you want to install, execute the appropriate createinstallmedia command in the Terminal.

Bash:
macOS Sonoma (14.x):
sudo /Applications/Install\ macOS\ Sonoma.app/Contents/Resources/createinstallmedia --volume /Volumes/USB

macOS Ventura:
sudo /Applications/Install\ macOS\ Ventura.app/Contents/Resources/createinstallmedia --volume /Volumes/USB

macOS Monterey:
sudo /Applications/Install\ macOS\ Monterey.app/Contents/Resources/createinstallmedia --volume /Volumes/USB

macOS Big Sur:
sudo /Applications/Install\ macOS\ Big\ Sur.app/Contents/Resources/createinstallmedia --volume /Volumes/USB

macOS Catalina:
sudo /Applications/Install\ macOS\ Catalina.app/Contents/Resources/createinstallmedia --volume /Volumes/USB

macOS Mojave:
sudo /Applications/Install\ macOS\ Mojave.app/Contents/Resources/createinstallmedia --volume /Volumes/USB

macOS High Sierra:
sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/USB

macOS Sierra:
sudo /Applications/Install\ macOS\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/USB --applicationpath /Applications/Install\ macOS\ Sierra.app

OS X El Capitan:
sudo /Applications/Install\ OS\ X\ El\ Capitan.app/Contents/Resources/createinstallmedia --volume /Volumes/USB --applicationpath /Applications/Install\ OS\ X\ El\ Capitan.app

OX X Yosemite:
sudo /Applications/Install\ OS\ X\ Yosemite.app/Contents/Resources/createinstallmedia --volume /Volumes/USB --applicationpath /Applications/Install\ OS\ X\ Yosemite.app

OS X Mavericks:
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/USB --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction

8. When prompted, enter your password.
View attachment 6029
NOTE: Sometimes, after you enter your password, the createinstallmedia will not start the process. It's due to the USB being in a locked state. In such cases, a workaround is to remove and replug the USB Flash Drive or just reformat it as shown in the above steps.

9. Press (Y) to confirm and then press enter key and it will start erasing the disk and will create macOS Bootable USB.
View attachment 6030View attachment 6031
If you're on Big Sur or later, the Terminal may prompt for access. When prompted, click on OK to allow access.
Screenshot 2023-06-05 at 1.31.30 PM-min.png

Once the process is completed, you'll see the following screen:
View attachment 6032
10. Quit Terminal. The USB Flash Drive will be renamed itself as per the OS X/macOS Installer

QUICK NOTE:
  • macOS/OS X Installer must exist in the Applications folder.
  • Createinstallmedia is only supported by OS X Mavericks and newer. For OS X 10.4-10.8, see Legacy OS X for more information.

For Linux Users

Open your browser.
Download macOS Installer of your choice (IntallAssistant.pkg) from the links given below. These are the latest available downloads, directly from the Apple servers and is pure vanilla and not modified in any way. The links are actively maintained to ensure you have the latest macOS version.

Code:
#macOS Sequoia (15.0) Beta 2
https://swcdn.apple.com/content/downloads/56/31/062-22031-A_W5CYUPUHNT/ud3vjnbs2w5yxby2v4eqhwkfbzx2xnjnk3/InstallAssistant.pkg

#macOS Sonoma (14.5)
https://swcdn.apple.com/content/downloads/32/06/062-01946-A_0PEP7JHIWA/1pfs4xh22555dj51fkep7w06s4eiezh21p/InstallAssistant.pkg

#macOS Ventura (13.6.7)
https://swcdn.apple.com/content/downloads/46/31/052-96247-A_MLN9N00Y8W/dmml3up52hrsb01krjtczmdhexiruv1b5m/InstallAssistant.pkg

#macOS Monterey (12.7.5)
https://swcdn.apple.com/content/downloads/02/18/052-96238-A_V534Q7DYXO/lj721dkb4wvu0l3ucuhqfjk7i5uwq1s8tz/InstallAssistant.pkg

#macOS Big Sur (11.7.10)
http://swcdn.apple.com/content/downloads/14/38/042-45246-A_NLFOFLCJFZ/jk992zbv98sdzz3rgc7mrccjl3l22ruk1c/InstallAssistant.pkg

#macOS Catalina
[URL unfurl="true"]https://swcdn.apple.com/content/downloads/32/06/062-01946-A_0PEP7JHIWA/1pfs4xh22555dj51fkep7w06s4eiezh21p/InstallAssistant.pkg[/URL]

#macOS High Sierra
[URL unfurl="true"]https://swcdn.apple.com/content/downloads/32/06/062-01946-A_0PEP7JHIWA/1pfs4xh22555dj51fkep7w06s4eiezh21p/InstallAssistant.pkg[/URL]

#OS X El Capitan
[URL unfurl="true"]https://swcdn.apple.com/content/downloads/32/06/062-01946-A_0PEP7JHIWA/1pfs4xh22555dj51fkep7w06s4eiezh21p/InstallAssistant.pkg[/URL]

Open Terminal
Bash:
sudo apt install genisoimage

Create an ISO file (InstallAssistant.iso) using the InstallAssistant.pkg and run_offline.sh using the following command.
Bash:
mkisofs -allow-limited-size -l -J -r -iso-level 3 -V InstallAssistant -o InstallAssistant.iso path/to/InstallAssistant.pkg scripts/run_offline.sh
Quit Terminal

See Chapter X Installation for more information on offline installation.


II. Online Method


1. Downloading macOS (10.7-13.4)

Using this method, you can download from OS X Lion 10.7 to macOS Ventura 13.4. However, these are the recovery image and therefore requires an internet connection to download the full installer during the time of installation. You'll need to have the exact Recovery image of the target OS you want to install. To download the recovery image, follow the steps below.

1. Within the downloaded OpenCorePkg (RELEASE), navigate to the Utilities/macrecovery directory.

View attachment 6011
2. Open the Terminal and execute the following commands.

Bash:
#Move to the directory
cd Downloads/OpenCore-0.9.2-RELEASE/Utilities/macrecovery

NOTE: Replace the X with the OpenCore version.

3. Depending on the macOS version you need (See Recovery Table below), execute the commands. When prompted, enter your password.

Recovery Table

OS VersionCommand
OS X Lionpython3 ./macrecovery.py -b Mac-C3EC7CD22292981F -m 00000000000F0HM00 download
OS X Mountain Lionpython3 ./macrecovery.py -b Mac-7DF2A3B5E5D671ED -m 00000000000F65100 download
OS X Maverickspython3 ./macrecovery.py -b Mac-F60DEB81FF30ACF6 -m 00000000000FNN100 download
OS X Yosemitepython3 ./macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000GDVW00 download
OS X El Capitanpython3 ./macrecovery.py -b Mac-FFE5EF870D7BA81A -m 00000000000GQRX00 download
macOS Sierrapython3 ./macrecovery.py -b Mac-77F17D7DA9285301 -m 00000000000J0DX00 download
macOS High Sierrapython3 ./macrecovery.py -b Mac-7BA5B2D9E42DDD94 -m 00000000000J80300 download
macOS Mojavepython3 ./macrecovery.py -b Mac-7BA5B2DFE22DDD8C -m 00000000000KXPG00 download
macOS Catalinapython3 ./macrecovery.py -b Mac-CFF7D910A743CAAF -m 00000000000PHCD00 download
macOS Big Surpython3 ./macrecovery.py -b Mac-42FD25EABCABB274 -m 00000000000000000 download
macOS Montereypython3 ./macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000000000 download
macOS Venturapython3 ./macrecovery.py -b Mac-7BA5B2D9E42DDD94 -m 00000000000000000 -os latest download

View attachment 6017
The script will start downloading the required recovery files:
View attachment 6018
6. Once the download is completed, you'll see something like below:
View attachment 6019
This will create a com.apple.recovery.boot directory inside OpenCore-0.X.X-RELEASE/Utilities/macrecovery directory.
View attachment 6022
You can find BaseSystem.dmg and BaseSystem.chunklist in OpenCore-0.X.X-RELEASE/Utilities/macrecovery/com.apple.recovery.boot directory.
View attachment 6023
NOTE:
  • Depending on the macOS version, the script will either download BaseSystem or RecoveryImage files.
  • Booting macOS Big Sur 11.3 and newer without mapping of the USB Ports will result in boot loop due to the broken XhciPort Limit. Therefore, it is recommended to install 11.2.3 or map your USB Ports first using Windows before installing macOS. Note that if you have already mapped your USB Ports, you can boot macOS 11.3 and newer without such issues. See Mapping USB Ports for more information.

2. Preparing Installer

Once you have the Recovery image, you can create the installer. To prepare the installer, follow the steps below

1. Insert your USB Flash Drive (less than 64GB ).
2. Open Disk Utility. The Disk Utility is located at /Applications/Utilities/Disk Utility
3. Click on View and then select Show All Devices.
View attachment 6028
4. Select your target USB Flash Drive in the left pane and click on Erase button at the top and a popup will appear.
5. Use the following parameters to erase your drive.

Name: EFI
Format: MS-DOS (FAT)
Scheme: Master Boot Record

View attachment 5862
6. When done, click on Done and close Disk Utility.

View attachment 5863

7. Copy the com.apple.recovery.boot folder downloaded in the above step to your USB Flash Drive in Finder. Please ensure that the directory contains BaseSystem.chunklist and BaseSystem.dmg files respectively.


For Windows users



STEP 1: Downloading macOS
You'll need to have the exact Recovery image of the target OS you want to install. To download the recovery image, follow the steps below.

1. Install the latest Python from the Microsoft Store.
2. Download OpenCore Pkg from the downloads section of this forum.
3. Extract the downloaded file to your Desktop.
4. Move into the OpenCore-0.X.X-RELEASE/Utilities directory
5. Right-click on macreceovery folder and select Copy as path

View attachment 4712


6. Open Command Prompt with Administrator Privileges

View attachment 4713


View attachment 4714


7. Type cd and then paste the path you copied earlier in step 5 and then press enter key. The command would be the following

Bash:
cd "C:\Users\Your User Name\Desktop\OpenCore-0.X.X-RELEASE\Utiities\macrecovery"

View attachment 4715

NOTE:
  • Replace the X with the OpenCore version.
  • Replace Your User Name with your actual username

8. Depending on the macOS version you need (See Recovery Table below), type the command.

Recovery Table

OS VersionCommand
OS X Lion./macrecovery.py -b Mac-C3EC7CD22292981F -m 00000000000F0HM00 download
OS X Mountain Lion./macrecovery.py -b Mac-7DF2A3B5E5D671ED -m 00000000000F65100 download
OS X Mavericks./macrecovery.py -b Mac-F60DEB81FF30ACF6 -m 00000000000FNN100 download
OS X Yosemite./macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000GDVW00 download
OS X El Capitan./macrecovery.py -b Mac-FFE5EF870D7BA81A -m 00000000000GQRX00 download
macOS Sierra./macrecovery.py -b Mac-77F17D7DA9285301 -m 00000000000J0DX00 download
macOS High Sierra./macrecovery.py -b Mac-7BA5B2D9E42DDD94 -m 00000000000J80300 download
macOS Mojave./macrecovery.py -b Mac-7BA5B2DFE22DDD8C -m 00000000000KXPG00 download
macOS Catalina./macrecovery.py -b Mac-CFF7D910A743CAAF -m 00000000000PHCD00 download
macOS Big Sur./macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000000000 download
Latest Version./macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000000000 -os latest download


View attachment 4716

9. Once the download is completed, you'll see something like below

View attachment 4717

You can find BaseSystem.dmg and BaseSystem.chunklist in OpenCore-0.X.X-RELEASE/Utilities/macrecovery directory.

View attachment 4758

NOTE:
  • Depending on the macOS version, the script will either download BaseSystem or RecoveryImage files.

STEP 2: Preparing Installer
Once you have the Recovery image, you can create the installer. To prepare the installer, follow the steps below

1. Insert your USB Flash Drive (less than 64GB) into your Windows Computer.
2. Download Rufus.
3. Open Rufus and under Device select your target USB Flash Drive
4. Under Boot selection select Non Bootable
5. Under Volume label type EFI
6. Under File System select Large FAT32 (default) and click on START.

View attachment 4718

7. When prompted, click on OK

View attachment 4719

Once erased, you'll see the READY status in Rufus

View attachment 4720

8. When done, click on Close to close Rufus.
9. Now open your USB Flash Drive in Explorer
10. Delete autorun.ico and autorun.inf file from the USB Flash Drive
11. Create a folder named com.apple.recovery.boot in root of the USB Flash Drive
12. Copy BaseSystem.dmg and BaseSystem.chunklist downloaded above into com.apple.recovery.boot directory.

For Linux users



STEP 1: Downloading macOS
You'll need to have the exact Recovery image of the target OS you want to install. To download the recovery image, follow the steps below.

1. Download OpenCore Pkg from the downloads section of this forum.
2. Extract the downloaded file
3. Move into the OpenCore-0.X.X-RELEASE/Utilities directory
4. Right click on macreceovery folder and select Copy

View attachment 4766
5. Open Terminal

View attachment 4767

View attachment 4768
6. Type cd and then paste the path you copied earlier in step 4 and then press enter key. The command would be the following

Bash:
cd /home/tech/Downloads/OpenCore-0.X.X-RELEASE/utilities/macrecovery

View attachment 4769

NOTE:
  • Replace the X with the OpenCore version.
  • Replace Your User Name with your actual username

7. Depending on the macOS version you need (See Recovery Table below), type the command.

Recovery Table

OS VersionCommand
OS X Lion./macrecovery.py -b Mac-C3EC7CD22292981F -m 00000000000F0HM00 download
OS X Mountain Lion./macrecovery.py -b Mac-7DF2A3B5E5D671ED -m 00000000000F65100 download
OS X Mavericks./macrecovery.py -b Mac-F60DEB81FF30ACF6 -m 00000000000FNN100 download
OS X Yosemite./macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000GDVW00 download
OS X El Capitan./macrecovery.py -b Mac-FFE5EF870D7BA81A -m 00000000000GQRX00 download
macOS Sierra./macrecovery.py -b Mac-77F17D7DA9285301 -m 00000000000J0DX00 download
macOS High Sierra./macrecovery.py -b Mac-7BA5B2D9E42DDD94 -m 00000000000J80300 download
macOS Mojave./macrecovery.py -b Mac-7BA5B2DFE22DDD8C -m 00000000000KXPG00 download
macOS Catalina./macrecovery.py -b Mac-CFF7D910A743CAAF -m 00000000000PHCD00 download
macOS Big Sur./macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000000000 download
Latest Version./macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000000000 -os latest download

View attachment 4770
8. Once the download is completed, you'll see something like below

View attachment 4771
You can find BaseSystem.dmg and BaseSystem.chunklist in OpenCore-0.X.X-RELEASE/Utilities/macrecovery directory.

View attachment 4773
NOTE:
  • Depending on the macOS version, the script will either download BaseSystem or RecoveryImage files.

STEP 2: Preparing Installer
Once you have the Recovery image, you can create the installer. To prepare the installer, follow the steps below

1. Insert your USB Flash Drive (less than 64GB) into your Ubuntu Computer.
2. Open Disks
View attachment 4774
For Unallocated Disks

1. For USB Drives which is unallocated, click on the Settings button and then click on Next

View attachment 4775

2. Under Volume Name, type EFI
3. Under Type, select For use with all systems and devices (FAT) and click on Create
View attachment 4776
4. Once erased, you'll see the created partition in Disks
View attachment 4777
5. Click on the play button to mount the USB Flash Drive
View attachment 4781

For USB with existing Data

1. For USB Drives which is unallocated, click on the Settings button and then click on the Format button


View attachment 4779
2. Click on Format

View attachment 4780

3. Once erased, you'll see the created partition in Disks

View attachment 4777
4. Click on the play button to mount the USB Flash Drive
View attachment 4781
Now open your USB Flash Drive in Explorer
Create a folder named com.apple.recovery.boot in the root of the USB Flash Drive
Copy BaseSystem.dmg and BaseSystem.chunklist downloaded above into com.apple.recovery.boot directory.







If you have followed/used/using offline method for creating the Virtual USB, the installation involves a bit few extra steps but is definitely worth it.


Special Procedures


Certain setups require specific configuration tweaks in order to work properly. If you are having problems getting your host or your virtual machine to work properly, see if your system matches one of the cases below and try adjusting your configuration accordingly.

As TrueNAS/UNRAID uses KVM/QEMU, please see for performance tuning for more information.


and Linux as Host OS.

CHAPTER 5: Performance Tuning​

KVM/QEMU Virtualization is the foundational technology and has one of the major use scenario in the cloud and homelab environment. This guide focuses on important aspects of performance tuning on (a hardware and software level) and is targeted towards the cloud administrators or the users who deploy KVM/QEMU solutions and want to achieve the best possible performance results on the target hardware. This guide assumes the readers (audience) has general knowledge of the Linux Operating System and KVM/QEMU based Virtualization.

This guide supports both, Intel and AMD platforms, but mainly focuses on Intel (consumer, workstation and Server) based platforms as its the popular choice amongst the Data Centers, Cloud platforms and System Administrators and aims to help the user to get the best virtualization performance on the target hardware, provided that the configuration is/are supported by the platform. In addition, this guide supports Windows, Linux, and macOS as a Guest OS. However, please note that due to the several limitations with macOS, some of the options are not available/applicable when using macOS as a Guest OS. Thus, on macOS side, the tuning/options is/are somewhat limited.

In addition, this guide also supports Intel Xeon Scalable Processor family is optimized. Please note that users must carefully consider these settings during the deployments for their specific scenarios as some of the settings/options mentioned, may not be available on the user's machine or may not be favorable for a specific workload or use case scenario. In addition, certain hardware may not meet the specific configuration mentioned in this guide and therefore you might have to adjust.adapt to the guide accordingly.

Source: PK/HL.

and willl help you to achieve the ultimate performance with the KVM/QEMU.

latency matters in a commercial enterprise environment such as Data Centers or other performance critical environments.


I. Hardware Tuning

Ensure you are using as fast as possible hardware components for the faster performance for the workloads you have. Plays a crucial role so is the BIOS.

BIOS Tuning

After picking the right hardware, it's the BIOS which controls most of the things in terms of feature and functions. Therefore, its crucial to have the right settings

SettingsRecommended Value
Virtualization TechnologyEnabled
VT-dEnabled
Hyper Threading TechnologyEnabled
SR-IOVEnabled
IOMMUEnabled
gg
gg
gg
gg
gg

Some settings from the above table may appear as different setting for your motherboard/for your system. Please check your Motherboard/system manual for more information. In addition, ensure that you have the latest BIOS installed.

II. Software Tuning

Unlike the hardware, the software is equally important and you must tune it in order to get the maximum possible performance out of the machine.

Linux Kernel and KVM Tuning


Processor Frequency


QEMU Tuning
Guest Kernel Tuning



Configure CPUs/CPU Tuning

Like a bare metal, a Virtual Machine also needs a Virtual Processor to process the given instructions. To configure the Processor, follow the steps below:

1. Select CPUs from the left pane.
2. Set the vCPU allocation to no more than half of the Threads available on the host computer. The virtual core allocation should be always under 50% of the actual physical CPU Cores. Allocating more than 50% of the physical core may slow down the host computer (e.g. i5-10400 is a 6 Core CPU which has 12 Threads so allocating 6 Virtual Cores is under the 50% utilization limit).

NOTE: You should not over provision the CPU as the VM will still run under the Host OS so having adequate amount of resources allocated on the host side is equally important. We recommend at least leaving 2 physical cores (minimum) reserved for the Host for a smooth operation.

CPU Topology

Any modern CPU that supports Hyper Threading Technology, you should definitely consider configuring CPU Topology configuration to improve performance under macOS. For most of the user, setting the vCPU allocation will work. However, in order to improve the macOS/guest OS performance/performance under guest OS, it is recommended to configure the CPU topology. This can be configured later, after the installation as well. It's an optional choice and entirely depends on you when you want to configure it. We recommend it doing before you start installing macOS.

1. From the CPUs page, select Select Manually set CPU topology to configure the CPU topology. This can be also configured after the installation to bring some improvement on the macOS side/guest OS.
2. Set Sockets as 1. If you have one physical CPU socket, use 1, and if you have dual, use 2.
3. Set the Cores to no more than half of the threads available on the host computer. The virtual core allocation should be always under 50% of the actual physical CPU Cores. Allocating more than 50% of the physical core may slow down the host computer (e.g. i5-10400 is a 6 Core CPU that has 12 Threads so allocating 6 Virtual Cores is under the 50% utilization limit).
4. Set the Threads as 2 for the Hyper-Threading to work in the guest Operating System. For CPUs that support Hyper-Threading Technology, the threads are usually twice the cores. Once set, you'll see that vCPU allocation will be configured automatically.
5. Click on Apply to save the changes.

NOTES:
  • For CPUs that does not support Hyper Threading Technology, you can just set/allocate the vCPUs.
  • Please note that odd Cores will not work in KVM and if you configure the CPU Topology with odd cores (such as 1, 3, 5, 7, etc.), powering up the VM will lead to boot failure.





Add Boot Disk​

Firstly, we'll create a New Virtual Hard Disk to use as a Boot Drive under macOS. This will be our Boot Disk, just like the physical USB you use on a Bare Metal but virtual ;)
Click on Add Hardware
From the Storage pane, select Select or create custom storage and click on Manage.
A window will pop up to browse the image. Click on Browse Local and select the Virtual USB Disk.img you created earlier in STEP #X. Once selected, click on Open.
Set VirtIO as Bus type.
Click on Advanced options and set Cache mode as writeback and then click on Finish. A VirtIO disk will be added to the VM.
Select VirtIO Disk 1 and click on XML tab right next to the Details tab to switch to XML editing.

Replace the following contents:

XML:
<disk type="file" device="disk">
  <driver name="qemu" type="raw" cache="writeback" io="threads" discard="unmap"/>
  <source file="/var/lib/libvirt/images/macOSS-2.raw"/>
  <target dev="vda" bus="virtio"/>
  <address type="drive" controller="0" bus="0" target="0" unit="1"/>
</disk>
with
XML:
<disk type="file" device="disk">
  <driver name="qemu" type="raw" cache="writeback" io="threads" discard="unmap"/>
  <source file="/var/lib/libvirt/images/macOSS-2.raw"/>
  <target dev="vda" bus="virtio"/>
  <address type="drive" controller="0" bus="0" target="0" unit="0"/>
</disk>



If you want to store the VM disks on a separate dedicated storage space instead of the Ubuntu boot disk, you can do that to improve performance. By default, the Virtual disks are stored at /var/lib/libvirt/images.

Click on Add Hardware
From the Storage pane, select Select or create custom storage and click on Manage.
A dialogue box will appear to locate or create storage volume. Click on + button at the bottom left corner to add a new storage pool.
Name your pool
From type select dir: Filesystem directory from the drop down list
Click on Browse and locate the path to the physical disk and click on Finish.
Select VMPool/From the left pane, select VMPool and click on + button right to the Volumes
Enter a name for your Disk. You can use any. For instance, we'll be using Virtual Disk
Select qcow2 as Format.
Under Format, select qcow2
From Format, select qcow2
Set the capacity to 35GiB and click on Finish. Set the required size for the zvol you wish/want to allocate for macOS and click on Finish. The minimum required size is 35GiB for macOS installation.
Select Virtual Disk.qcow2 from the Volumes list and click on Choose Volume.

Dedicated Disk​

Using a dedicated physical disk is way faster than qcow2 or the raw image and provides a rock solid performance overall.

Grab the disk path either from the Disks app or Terminal and note it down for further step.
Click on Add Hardware
From the Storage pane, the default option will be selected. Here, we'll create a dummy disk and then replace it with a physical disk you wish/want to use.
Set the size to 1GiB as we'll delete this after replacing it with a physical disk.
Set Bus type as SATA
Click on Advanced options and set Cache mode as unsafe and then click on Finish. A VirtIO disk will be added to the VM.
Select SATA Disk 1 and click on XML tab right next to the Details tab to switch to XML editing.

Replace the following contents:

XML:
<disk type="file" device="disk">
  <driver name="qemu" type="raw"/>
  <source file="/var/lib/libvirt/images/macOSS-2.raw"/>
  <target dev="sdb" bus="sata"/>
  <address type="drive" controller="0" bus="0" target="0" unit="1"/>
</disk>
with
XML:
<disk type="block" device="disk">
  <driver name="qemu" type="raw" cache="writeback" io="threads" discard="unmap"/>
  <source dev="/dev/nvme1n1"/>
  <target dev="sdb" bus="sata" rotation_rate="1"/>
  <address type="drive" controller="0" bus="0" target="0" unit="1"/>
</disk>


VirtIO
XML:
<disk type="file" device="disk">
  <driver name="qemu" type="qcow2" cache="none" discard="unmap"/>
  <source file="/var/lib/libvirt/images/macOSAHetff.qcow2"/>
  <target dev="vda" bus="virtio"/>
  <address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</disk>

XML:
<disk type="block" device="disk">
  <driver name="qemu" type="raw" cache="none" io="native" discard="unmap"/>
  <source dev="/dev/nvme0n1"/>
  <target dev="vdb" bus="virtio"/>
  <address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</disk>

Raw and qcow2 especially can have noticeable overhead for heavy IO. A whole disk or a partition may be used directly to bypass the filesystem and improve I/O performance. If you wish to dual boot the guest OS natively you would need to pass the entire disk without any partitioning. It is suggested to use /dev/disk/by- paths to refer to the disk since /dev/sdX entries can change between boots. To find out which disk/partition is associated with the one you would like to pass:



RAW and QCOW2 especially can have noticeable overhead for heavy IO. A whole disk or a partition can be used directly to bypass the filesystem and improve I/O performance overall. If you wish to use a dedicated disk for the guest OS, you would need to pass the entire disk without any partitioning. It is recommended to use /dev/disk/by-id of the designated disk you want to passthrough since the /dev/sdx location is not persistent and can change across reboots.

Where, is the full disk and is a partition of the disk.

$ ls -l /dev/disk/by-id/*
/dev/disk/by-id/ata-ST1000LM002-9VQ14L_Z0501SZ9 -> ../../sdd

See #Virtio disk on how to add these with libvirt XML. You can also add the disk with Virt-Manager's Add Hardware menu and then type the disk you want in the Select or create custom storage box, e.g. /dev/disk/by-id/ata-ST1000LM002-9VQ14L_Z0501SZ9

Bash:
elitemac@elitemac-CF:~$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0         7:0    0     4K  1 loop /snap/bare/5
loop1         7:1    0  74.2M  1 loop /snap/core22/1380
loop2         7:2    0  73.9M  1 loop /snap/core22/864
loop3         7:3    0 240.5M  1 loop /snap/firefox/3216
loop4         7:4    0  11.2M  1 loop /snap/firmware-updater/109
loop5         7:5    0  10.7M  1 loop /snap/firmware-updater/127
loop6         7:6    0   497M  1 loop /snap/gnome-42-2204/141
loop7         7:7    0  91.7M  1 loop /snap/gtk-common-themes/1535
loop8         7:8    0  10.5M  1 loop /snap/snap-store/1046
loop9         7:9    0  40.9M  1 loop /snap/snapd/20290
loop10        7:10   0  38.8M  1 loop /snap/snapd/21759
loop11        7:11   0   452K  1 loop /snap/snapd-desktop-integration/83
nvme1n1     259:0    0 476.9G  0 disk
├─nvme1n1p1 259:1    0 475.9G  0 part /var/snap/firefox/common/host-hunspell
│                                     /
└─nvme1n1p2 259:2    0     1G  0 part /boot/efi
nvme0n1     259:3    0 238.5G  0 disk
└─nvme0n1p2 259:6    0 238.3G  0 part

Bash:
elitemac@elitemac-CF:~$ ls -l /dev/disk/by-id
total 0
lrwxrwxrwx 1 root root 13 Jul 19 14:33 nvme-eui.6479a744702013b2 -> ../../nvme0n1
lrwxrwxrwx 1 root root 15 Jul 19 14:33 nvme-eui.6479a744702013b2-part2 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 13 Jul 19 13:57 nvme-eui.e8238fa6bf530001001b448b4b423416 -> ../../nvme1n1
lrwxrwxrwx 1 root root 15 Jul 19 13:57 nvme-eui.e8238fa6bf530001001b448b4b423416-part1 -> ../../nvme1n1p1
lrwxrwxrwx 1 root root 15 Jul 19 13:57 nvme-eui.e8238fa6bf530001001b448b4b423416-part2 -> ../../nvme1n1p2
lrwxrwxrwx 1 root root 13 Jul 19 14:33 nvme-GIGABYTE_GP-GSM2NE3256GNTD_SN210108931914 -> ../../nvme0n1
lrwxrwxrwx 1 root root 13 Jul 19 14:33 nvme-GIGABYTE_GP-GSM2NE3256GNTD_SN210108931914_1 -> ../../nvme0n1
lrwxrwxrwx 1 root root 15 Jul 19 14:33 nvme-GIGABYTE_GP-GSM2NE3256GNTD_SN210108931914_1-part2 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 15 Jul 19 14:33 nvme-GIGABYTE_GP-GSM2NE3256GNTD_SN210108931914-part2 -> ../../nvme0n1p2
lrwxrwxrwx 1 root root 13 Jul 19 13:57 nvme-PC_SN810_NVMe_WDC_512GB_221562802322 -> ../../nvme1n1
lrwxrwxrwx 1 root root 13 Jul 19 13:57 nvme-PC_SN810_NVMe_WDC_512GB_221562802322_1 -> ../../nvme1n1
lrwxrwxrwx 1 root root 15 Jul 19 13:57 nvme-PC_SN810_NVMe_WDC_512GB_221562802322_1-part1 -> ../../nvme1n1p1
lrwxrwxrwx 1 root root 15 Jul 19 13:57 nvme-PC_SN810_NVMe_WDC_512GB_221562802322_1-part2 -> ../../nvme1n1p2
lrwxrwxrwx 1 root root 15 Jul 19 13:57 nvme-PC_SN810_NVMe_WDC_512GB_221562802322-part1 -> ../../nvme1n1p1
lrwxrwxrwx 1 root root 15 Jul 19 13:57 nvme-PC_SN810_NVMe_WDC_512GB_221562802322-part2 -> ../../nvme1n1p2
elitemac@elitemac-CF:~$



XML:
<disk type="block" device="disk">
  <driver name="qemu" type="raw" cache="none" io="native" discard="unmap"/>
  <source dev="/dev/disk/by-id/nvme-GIGABYTE_GP-GSM2NE3256GNTD_SN210108931914"/>
  <target dev="vdb" bus="virtio"/>
  <address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</disk>

NOTE: Replace nvme1n1 with your actual physical device.
If you're an experienced user/if you have experience with Linux and editing, you can add this code directly to the XML file of the macOS VM.

Removing Disk
This step is completely optional and is entirely dependent on you.

Click on Add Hardware
From the Storage pane, select Select or create custom storage and click on Manage.
A dialogue box will appear to locate or create storage volume.
Select Virtual Disk.qcow2 from the Volumes list and click on Delete Volume. When prompted, click on Yes.
Click on Cancel to close the dialog boxes.


A host drive used by a VM Guest must not be accessed concurrently by the VM Host Server or another VM Guest.

Passthrough

Remove Unused Devices​

Removing devices which are of no use and/or that cannot be utilized by macOS can bring a significant improvements on the macOS VM, resulting in faster boot times.


CPU Pinning

Virtual Disks

KVM offers several advantages and flexibility over bare metal installation such as



This will increase the disk performance and you will notice/see a significant improvement with the Read/Write speeds.

TRIM

RAW vs QCOW2
The QCOW2 performance is very different than after a month of active use. The default image store type is QCOW2. However, QCOW2 offers several benefits such as snapshots.

Cache Mode


If you are serious about the KVM performance/performance under the guest OS, you should really consider selecting the right parts for the Virtualization. Of course, you can experiment with your old gears you have and its fun. But for performance demanding applications and enterprise critical environments, this is not going to serve you. You need a strategy, a plan for the deployment.

and it starts with picking the right hardware components in the first place

WebGUI

By default, Ubuntu does not comes with WebUI management unlike other platfor

Unlike other Virtualization platforms like VMware ESXi, Proxmox, TrueNAS, UNRAID, the Ubuntu does not comes with WebUI manager. However, for the ease of


If you like how ESXi, Proxmox, TrueNAS and Unraid can be managed using the Web UI, don’t worry. Ubuntu has got the flexibility too


WebUI offers flexibility to manage the server over network without having physical access to the machine

Those who have only one single GPU and want to take advantage of virtualization, configuring a WebUI would be really useful. can take advantage of WebUI and configure everything on the fly, provided that you need to configure the WebUI before you start the passthrough.

Installing WebGUI


1. Open Terminal and execute the following commands:

2. Update the system package list using:
Bash:
sudo apt update

3. Install cockpit console using:
Bash:
sudo apt install cockpit

4. Once the cockpit console is installed, you need to install the cockpit-machines package to help you manage the virtual machines.
Bash:
sudo apt install cockpit-machines

5. Once installed successfully, start Cockpit using:
Bash:
sudo systemctl start cockpit

6. Verify the cockpit status using
Code:
sudo systemctl status cockpit

You should see something like below. The output below confirms that the cockpit GUI is running as expected and you should be able to access using your favorite web browser.

Accessing WebUI


If you are unable to find, simply use any IP scanner such as Advanced IP Scanner or Angry IP Scanner to scan the available networks.

The offline way of installing macOS on KVM is bit different than the normal offline installer made under macOS using the .app downloaded via App Store or extracted using the InstallAssistant.pkg file.



If you're using Rocket Lake or above, you can either spoof the CPU via the QEMU itself or via the config.plist. However, please note that as QEMU has limited pre-defined CPU list, it may not possible to spoof the unsupported CPU using QEMU and you'll need to spoof the CPU ID via the config.plist. For example, Comet Lake option isn't available.


macOS Updates​



The macOS updates can be installed and processed normally, worry-free, just like a bare metal machine with OpenCore Bootloader using the Software Update mechanism from the System Preferences. As always, you must update the OpenCore and the related kexts before applying any updates to the system. See updating macOS for more information. The instructions are same as bare metal.


Updating Linux Host​

The Linux (whatever distribution you have) updates can be applied to the Host machine normally, as usual. Make sure the host has access to the internet via DHCP and then you can simply update the TrueNAS using System Settings>Update menu. Once the updates are downloaded and ready, reboot the host to process the updates.


Troubleshooting​


A very fast, stable internet connection is required due to the offline installer. Being an online installer, the installer fetches the InstallAssistant.pkg for the desired macOS version. If there are frequent dropouts, the download will fail and the installation will be terminated with the reason

Validation errors: VM X does not exists​

Here, the X could be any VM ID. Make sure you're editing the correct VM. You can get the VM ID using the service vm query command in the CLI. Once you get the correct VM ID

Stuck at [PCI configuration begin] error when booting the macOS Virtual Machine.​

Whenever you make any changes in the Virtual Machine, be it either a Graphics Passthrough, a USB Device, or any other PCI Device Passthrough, make sure to restart the TrueNAS Host to avoid the [PCI configuration begin] error when booting the macOS Virtual Machine.

When you enable passthrough, be it either a Graphics passthrough or a USB Device or any other PCI Device passthrough, the macOS VM will not boot with the verbose (-v) enabled in the config.plist.

No Display/Stuck at TianoCore screen on the connected monitor​

If you're using GPU passthrough, make sure to remove the Display Device from the target Virtual Machine. See GPU passthrough for more information.

ROM Bar
do not enable ROM BAR and specify a VBIOS.rom

No Virtual Disk in Disk Utility​

Once you add the disk (Zvol), restart the TrueNAS Host to make the required changes. Until you restart the TrueNAS Host, you'll not be able to attach the disk to the macOS VM.

LUN Passthrough
 
Last edited:

Trending Threads

Forum statistics

Threads
1,637
Messages
15,376
Members
23,452
Latest member
timothee