- Joined
- Jul 22, 2018
- Messages
- 9,313
- Motherboard
- Supermicro X11SPA-T
- CPU
- Intel Xeon W-3275 28 Core
- Graphics
- 2xAMD RX 580 8GB
- OS X/macOS
- 13.x
- Bootloader
- OpenCore (UEFI)
- Mac
- Mac mini
- MacBook Pro
- Mobile Phone
- Android
- iOS
How to Install macOS on QEMU/KVM [Intel/AMD]
OverviewAs this guide is quite lengthy due to its detailed explanations and outlining the issues you may encounter during the installation, this guide is divided into Chapters to make it easier for the users.
What is QEMU/KVM?
What is Libvirt?
Can I setup Virtualization on a single GPU?
Although, it's 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, unless you're expert with commands. However, to overcome this issue, you can use WebUI and everything can be easy peasy. Server and Workstation grade systems does not have IGPU but the BMC can be super useful in this case. This can work if you do not want to operate the Host OS because the ASPEED Graphics (built-in) often have poor graphics performance and if you have purposes like AI training, you'll need to have a separate GPU allocated to the Host and the other compatible one for macOS.Does VMware ESXi need a Bootloader?
Unlike Hyper-V, VMware Workstation and Virtual Box do not require any Bootloader like OpenCore or Clover. This not only removes the tedious work of creating a compatible EFI but also provides flexibility when performing updates under macOS as you don't have to keep updating the OpenCore and the kexts along with. Although VMware Workstation is compatible with OpenCore, it should be noted that OpenCore requires additional configuration that is not covered in this guide.However, you may need to use a Bootloader (OpenCore) to drive certain hardware which does not have native support (driver-free) under macOS.
Although the VMware ESXi does not require a Bootloader to run macOS, it does supports bootloaders such as Clover and OpenCore.
Unlike bare metal, the AMD CPU isn't supported for booting macOS on VMware Workstation. However, by adding a few parameters in the Virtual Machine Configuration File, you can use VMware on AMD systems for booting macOS. See Enabling AMD CPU Support for more information.
Unlike other platforms,
Unfortunately, VMware Workstation doesn't support GPU passthrough, therefore no Graphics acceleration. With 3D acceleration, the guest OS gets access to a virtual GPU that understands GPU specific features such as DirectX. The VM driver+virtual hardware translates the 3D acceleration commands that it receives and executes those on the GPU hardware. Since VMware Workstation 15.5, it uses a special sandboxed process for that.
If you need functionality like Graphics acceleration and PCI Passthrough, VMware ESXi is the way. See installing macOS on VMware Exsi for more information.
Can you passthrough PCI Devices on VMware Workstation?
Does VMware Workstation support iServices?
Is there any performance difference between Bare Metal and VMware?
Yes, there is a lot of performance difference when running macOS on a Bare Metal and VMware Workstation/Player due to the lack of Graphics acceleration which isn't supported by either of the two versions. The system has lots of glitches, and artifacts and you can use it temporarily for executing basic functions on macOS. However, with VMware EXSi, the performance is close to the native/bare metal install. See installing macOS on VMware ESXi for more information.This is because of the lack of Graphics acceleration and unfortunately, the GPU passthrough isn't supported by either of the two versions.
What's the difference between running macOS on a Bare Metal and Hyper-V?
Running macOS on a bare metal means you're running macOS on the native hardware, without any layers in between therefore offering more performance and access to the hardware directly.Can I use the ISO File from somewhere else?
We strongly recommend performing a clean install and then you can export the VHD for latter usage.Is it possible to perform a clean install?
Yes, using this guide, you can perform a clean install of the desired macOS version as long as you meet the requirements.Is it recommended to install macOS on VMware ESXi?
The answer is it depends. If your hardware is supported, installing macOS on bare metal is always recommended due to the ease of the installation and seamless support due to the maximum performance, support and compatibility.If you have a machine with crazy specs and you're in an environment where other users need to use macOS, instead of using a different machine for each user, you can deploy VMware ESXi on the target host and can create multiple VMs for the X number of users who want to use macOS, hence cutting down the infrastructure expenses. This is just not especially for macOS but for other Operating Systems as well as VMware ESXi supports multiple
This just does not especially apply to macOS but to other Operating Systems as well. VMware ESXi supports several major Operating Systems including Microsoft Windows, Ubuntu, and Linux. By utilizing one powerful server, you just not only cut down the IT expenses but can have low maintenance costs as well. low upkeep as well.
You just not only cut down your IT expenses but you'll have a low upkeep as well, offering more uptime and easy management.
macOS Support Table
As of now, the Hyper-V supports the installation of OS X El Capitan to macOS Sequoia.
| macOS version | Status | NOTES |
|---|---|---|
| macOS Sequoia | Working | |
| macOS Sonoma | Working | |
| macOS Ventura | Working | |
| macOS Monterey | Working | |
| macOS Big Sur | Working | |
| macOS Catalina | Working | |
| macOS Mojave | Working | |
| macOS High Sierra | Working | |
| macOS Sierra | Working |
Current Status
Although different models can have different specs and the hardware component/model can differ from manufacturer to manufacturer, here is a list of the current status in terms of functions under macOS.| Hardware/Function | Status | Notes |
|---|---|---|
| Brightness Control | Not working | |
| USB Ports | Functional | |
| Keyboard | Functional | |
| Keyboard Backlight | Working | |
| Trackpad | Functional | |
| Touchscreen | Working | |
| Camera | Working | |
| Card Reader | Not working | Intel Card Readers are simply not supported |
| Battery | Working | |
| Ethernet | Functional | |
| WiFi/BT | Functional | Realtek and MediaTek Chipsets are not supported |
| Audio | Functional | |
| HDMI | Working | |
| Power Management | Functional | |
| Shutdown/Reboot | Functional | |
| Sleep/Wake | Not available | Typically, VM does not support Sleep/wake functions. |
| iServices | Functional |
Requirements
Following are the requirements for installing macOS on QEMU/KVM. Please ensure you meet the requirements before proceeding with this guide.| CPU | Intel (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. |
| Motherboard | A Compatible Motherboard with VT-X/AMD SVM option in BIOS/UEFI. Enterprise grade/HEDT grade motherboard is preferred to have enough dedicated lanes and separate IOMMU groups. SR-IOV for PCI Passthrough. Some vendors may not list it explicitly in the BIOS/UEFI firmware. Only Intel and AMD Chipsets are supported at the moment. |
| Memory | 16GB or more |
| Storage | 50GB of free space on the Linux Drive or a separate drive with 128GB or more capacity. A separate Drive is usually recommended. |
| Operating System | Any Modern Linux Distribution. e.g. Ubuntu 22.04 LTS 64-bit/Linux Mint/Fedora Linux/Arch Linux/Manjaro or later |
| Software | QEMU 7 or later Vim Editor |
| Tools | OpenCorePkg OCAT |
requires basic Terminal and command line skills
PRO Tip: If you are an advanced user, you can enable the Passthrough and a lot things tuned up/optimized since the beginning and you can have a complete bare metal experience.
This guide uses Ubuntu LTS as a host Operating System. You will need to adapt as per your linux distribution such as Pop OS!
The amazing thing is it does not require any Mac system to prepare the files and/or configuration.
No Mac system is required for this guide.
This guide supports various Linux editions such as Fedora, Kali Linux
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 1: Adjust BIOS/UEFI Settings
This chapter covers BIOS related settings which are crucial for the VM operation and PCIe passthrough.STEP 1: 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 motherboard's user manual for the BIOS Key
2. Adjust the settings below:
| SETTINGS | ENABLE/DISABLE | NOTES |
|---|---|---|
| Virtualization Technology | Enabled | This is usually present as Intel VT-x or Intel Virtualization Technology and AMD-V option in BIOS. |
| VT-d | Enabled | |
| SR-IOV | Enabled | |
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. Boot to your Host OS.
2. 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.
STEP 3: Verify/Check KVM Virtualization
1. 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.
CHAPTER 2: Install QEMU/KVM
This chapter describes installing QEMU/KVM.STEP 1: Update System
Before you begin to install QEMU, ensure you're using the latest version of the Linux distribution. This step may need to be adapted for your Linux distribution.1. Open Terminal and execute the following commands:
Bash:
#Update the system package list using:
sudo apt update
#Update the kernel and other packages using:
sudo apt upgrade
2. When prompted, type Y and press enter key
STEP 2: Install QEMU
Once the system packages are upgraded, continue to install QEMU/KVM.1. Assuming the Terminal window is still open, execute the following commands in the same terminal window:
Bash:
sudo apt install qemu-system
3. When prompted, type Y and press enter key
Bash:
#Install virt manager using:
sudo apt install virt-manager
Bash:
#Enable VirtManager
sudo systemctl enable --now libvirtd[/FONT]
#Start Virtmanager
sudo systemctl start libvirtd
#Check the status of virtmanager
sudo systemctl status libvirtd
5. You should find Virtual Machine Manager under Apps.
STEP 3: Add Necessary Permissions
Once the QEMU/KVM is installed, you must add the necessary permissions for the KVM to work and access OpenCore Virtual disk and ROM files for passthrough.1. Assuming the Terminal window is still open, execute the following commands one by one in the same terminal window:
Bash:
sudo usermod -aG kvm $(whoami)
sudo usermod -aG libvirt $(whoami)
sudo usermod -aG input $(whoami)
sudo setfacl -m u:libvirt-qemu:rx /home/$USER
2. Quit Terminal.
3. Restart your system and login back to your Host OS.
NOTE: If you're using a complex setup like @ where he uses for data training and AI stuff, you should avoid updating the kernel as it will likely break the configuration.
STEP 4: 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. Follow the steps below to enable XML editing:1. Open Virtual Machine Manager from Apps.
2. From Virtual Machine Manager, click on Edit and then select Preferences.
3. 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 3: Creating Virtual Machine
Now, as QEMU/KVM is installed, its time to create Virtual Machine. Follow the steps below to create Virtual Machine:1. Open Virtual Machine Manager from Apps.
2. 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.
3. A Window will pop up. From there, select Manual install.
4. Set Architecture to x86_x64 under the Architecture options and click on Forward.
5. Now it's 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.
6. 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.
For macOS Big Sur and later, at least 8GB of memory is recommended.
7. 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).
8. 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.
9. Specify a name for your Virtual Machine. For instance, we'll be using macOS. You can use any name.
10. Select Customize configuration before install. This is important!
11. 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 4: 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:
I. Configure Hypervisor
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, its highly recommended to use the UEFI mode for the advantages it offers. Follow the steps below to configure the hypervisor: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.
Do NOT use UEFI as it supports secure boot and you'll have to enroll the OpenCore and macOS boot files in order to boot from UEFI firmware. While the UEFI option should work fine for Windows or other Operating System, it will not let you boot via OpenCore. In order to boot the OpenCore, you'll need to disable Secure Boot. By default, the Secure Boot is enabled for security purposes with this firmware. If you want to use macOS with Secure Boot with macOS VM, see Secure Boot section for more information.
II. 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.1. Select
NIC: XX:XX:XX from the left pane.2. Set Network source as
Virtual network 'default': NAT from the drop down list.3. Set Device model as
Virtio from the drop down list. By default, it's set as e1000e.NOTE: 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.
III. 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.1. Click on Add Hardware.
2. From the Storage pane, the default option will be selected.
3. 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.
4. Set Bus type as
VirtIO.5. Click on Advanced options and set Cache mode as unsafe and then click on Finish. A VirtIO disk will be added to the VM.
NOTE: If you want to install macOS on a dedicated physical disk (preferred), see Disk Passthrough for more information.
III. Configure USB
By default the USB is set as USB 2 and will not work. To make the USB ports working, you'll have to configure it. To configure the USB follow the steps below:1. Select
Controller USB 0 from the left pane.2. Set Model as
USB 3 and click on Apply.3. Click on Overview and then click on the XML tab just right next to the Details tab to switch to XML editing.
4. Find and Replace the <controller type="usb" index="0" model="qemu-xhci" ports="15"> with <controller type="usb" index="0" model="qemu-xhci" ports="7">
5. Click on Apply.
IV. 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, macOS can boot without it but certain things won't likely work (such as network) unless you add these parameters. Follow the steps below to add the QEMU parameters:1. Click on Overview and then click on the XML tab just right next to the Details tab to switch to XML editing.
2. Replace the
<domain type="kvm"> line with <domain xmlns:qemu="http://libvirt.org/schemas/domain/qemu/1.0" type="kvm">.3. Scroll down at the end of the line and add the following just above the "</domain>" line:
Code:
<qemu:commandline>
<qemu:arg value="-global"/>
<qemu:arg value="ICH9-LPC.acpi-pci-hotplug-with-bridge-support=off"/>
<qemu:arg value="-device"/>
<qemu:arg value="isa-applesmc,osk=ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"/>
<qemu:arg value="-cpu"/>
<qemu:arg value="host,vendor=GenuineIntel"/>
</qemu:commandline>
NOTE: If you're using AMD CPU, you'll have to
Please note that the letters are case-sensitive.
CHAPTER X: Installing macOS
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.Yes, you have waited for a long and its time to install macOS now. Excited?
Installing macOS on a shared Drive
If you're using a Virtual Drive and want to install macOS on it, follow the steps below: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 on a dedicated Separate Physical Drive
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. You can either passthrough the NVMe directly or can passthrough as individual disks. For SATA, you can either passthrough the entire SATA Controller and all the disks connected to it will be also passthroughed. However, if there is a single SATA Controller on the motherboard and that is not in separate IOMMU group, you would not be able to passthrough the entire SATA Controller. However, you can passthrough the SATA devices as individual disks using multiple ways.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.
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.
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 and lacks graphics passthrough.
CHAPTER X: 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.
I. 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
II. 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!
III. 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 every time 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 without 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
Power Management is one of the things you should implement when configuring Post Install. As the performance heavily relies on Power Management, using Dummy Power
Unlike Bare Metal, the VM also needs to be configured for proper management. As the resource is limited on the macOS Virtualization, many are just not aware and the performance is limited due to that. Luckily, macOS can detect if the system is running on a Virtualization platform and therefore automatically injects VMPlatformPlugin to improve the VM performance. Similar to Bare Metal approach, you need to set PluginType to 0x02.
For the XCPM Models, the Power Management chart is as follows
Verifying VM Configuration
A dedicated thread also exists for the Power Management when Virtualizating macOS/Virtualization Platforms. See below for more information.
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 Shut Down button from the Virtual Machine Manager. However, it is always recommended to perform a clean Shut Down within macOS to avoid data loss. You just have to be a little patient when performing these power related tasks. Sometimes, it can more time than expected.The Sleep/Wake, Restart and ShutDown function works normally as bare metal.
works with no issues
works normally as it should
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.
CHAPTER X: PCIe Passthrough
The real adventure begins/starts hereBefore you begin with devices passthrough to the VM, you should understand about a few terms and how this actually works along with the limitations that you may come across when configuring passthrough.
IOMMU Groups
Understanding Passthrough Limitations
You cannot passthrough any device to the Guest OS (VM) due to certain limitations. If a PCI device you want to passthrough is tied/grouped with other PCI devices, then you have two options: (i) passthrough all the devices in that group. Although this may work in some case, it won't in most of the cases due to how the IOMMU groups are defined on the system. This is because, some of these devices are crucial for the Host OS functioning and passthrouging these devices may result in a system crash. For example, @willg had a system with the following specs GIGABYTE Z690 paired with Intel Core i9-12900K and the user wanted to passthrough the Intel IGPU to the VM for transcoding and QuickSync purposes while the RX5700XT serve as a main display. However, when looking at the IOMMU groups, we find that the Intel IGPU had a separate IOMMU however for a GPU passthrough, you must passthrough both the GPU+Audio device together to the VM. However, the Intel IGPU Audio (Group 15) was shared with 3 other devices (LPC, SMBus and SPI). When you just passthrough the Audio device, powering on the VM throws an error and when passing through all these 3 other devices results in a system crash with the following error:
[EFAULT] internal error: QEMU unexpectedly closed the monitor (vm='1_Windows'): 2026-01-13T08:22:35.916964Z qemu-system-x86_64: warning: Machine type 'pc-q35-6.2' is deprecated: machines more than 3 years old are subject to deletion after 6 years 2026-01-13T08:22:36.881635Z qemu-system-x86_64: -device {"driver":"vfio-pci","host":"0000:00:1f.3","id":"hostdev4","bus":"pci.9","addr":"0x1"}: vfio 0000:00:1f.3: group 15 is not viable Please ensure all devices within the iommu_group are bound to their vfio bus driver. as some of these devices are crucial for Host OS functioning; (ii) Use ACS override patch. Although, not guaranteed, but it may work in certain cases. See Bypassing IOMMU Groups for more information.Bypassing IOMMU Groups
If you find that the PCI device you want to passthrough is tied/grouped with other devices that you do not want to passthrough (some simply cannot as they're crucial for host system), then you might be able to separate them using several ways: (i) the ACS override patch. This comes with a potential risk. ; (ii) move the PCI device to a different slot ; and (iii) choose a different motherboard.
I. Storage Passthrough
There are ideally 3 ways to passthrough a storage device to the macOS VM which are described below. Depending on your preference, choose one accordingly.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
Currently, SATA and VirtIO disk types are supported under macOS. SCSCI and LUN Passthrough does not work.
Use QCOW2 if you want to use Snapshot feature.
II. Input Passthrough
Using the Spice or VNC or any remote viewing app, you can control your virtual machine. Although, one can passthrough it via PS2/USB, it adds up extra latency and overhead. Generally, Keyboard and Mouse are one of the basic and important peripherals for any OS. The Keyboard and Mouse can be passthroughed through severals ways.USB Host Device
See Individual Passthrough for more information.
Evdev Passthrough
Sharing Keyboard and Mouse across Host and Guest
It's quite easy to share the keyboard and Mouse between the host and guest if you have two separate of them, dedicated for each OS. However, this is not feasible and eats up your desk space and adds extra clutter to the setup. Moreover, its not that feasible to use two different keyboard and Mouse for both the OS. To fix this issue, we can utilize the built-in evdev. Not only you can passthrough the Keyboard and Mouse but any other USB device as well. The biggest advantage is that the evdev has a very low latency and overheadIf you don't have a dedicated keyboard and Mouse for your macOS guest, and you don't want to suffer from Spice video overhead, you can setup evdev to share them across your Linux host and your macOS Virtual Machine. This method is far better and preferred than the Individual USB Passthrough method as the USB device location is not persistent and can change across reboots which can result in fatal error when booting up the VM and you'll have to remove the old USB device and then passthrough it to make it work again.
STEP 1: Finding the correct input devices
1. Open Terminal and execute the following command:
Bash:
ls -l /dev/input/by-id
You'll see something like the following output below:
Bash:
elitemac@elitemac-CF:~$ ls -l /dev/input/by-id
total 0
lrwxrwxrwx 1 root root 10 Jan 12 02:31 usb-Evision_RGB_Keyboard-event-if01 -> ../event27
lrwxrwxrwx 1 root root 10 Jan 12 02:31 usb-Evision_RGB_Keyboard-event-kbd -> ../event25
lrwxrwxrwx 1 root root 10 Jan 12 02:31 usb-Evision_RGB_Keyboard-if01-event-mouse -> ../event28
lrwxrwxrwx 1 root root 9 Jan 12 02:31 usb-Evision_RGB_Keyboard-if01-mouse -> ../mouse3
lrwxrwxrwx 1 root root 10 Jan 11 12:20 usb-Generic_USB_Audio-event-if03 -> ../event29
lrwxrwxrwx 1 root root 9 Jan 11 23:47 usb-Logitech_USB_Receiver-if02-event-kbd -> ../event3
lrwxrwxrwx 1 root root 9 Jan 11 23:47 usb-Logitech_USB_Receiver-if02-event-mouse -> ../event6
lrwxrwxrwx 1 root root 9 Jan 11 23:47 usb-Logitech_USB_Receiver-if02-mouse -> ../mouse2
elitemac@elitemac-CF:~$
2. Find your target Keyboard and Mouse. Only devices with the event in the input name are valid. It's quite possible that there could be multiple devices associated to your keyboard or mouse. If you're still confused, then see locating/find the right keyboard and mouse below:
1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
2. Click on Add Hardware. A new dialogue box should appear to add the New Virtual Hardware Devices.
3. Select USB Host Device from the left pane.
4. Note down the list of Keyboard and Mouse. If there's only one single Keyboard and Mouse (typical), then there shouldn't be much issue.
5. Click on Cancel.
NOTE:
Some Keyboard and Mouse may appear as unifying receiver (the one that comes with wireless dongle)
STEP 2: Add Input Devices to your VM
1. Copy the target id of your keyboard and mouse.
1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
5. Switch switch to XML tab.
6. Scroll down to the bottom and find the block with "<device> ... </device>" and use the following synatx to add your keyboard and mouse:
XML:
<input type='evdev'>
<source dev='/dev/input/by-id/MOUSE_NAME'/>
</input>
<input type='evdev'>
<source dev='/dev/input/by-id/KEYBOARD_NAME' grab='all' repeat='on' grabToggle='ctrl-ctrl'/>
</input>
MOUSE_NAME and KEYBOARD_NAME with your actual physical device path.8. Quit Terminal.
STEP 3: Switch to VirtIO Input
It's highly recommended to switch to VirtIO instead of default PS/2 input.
Assuming the XML window is still open:
1. Find the line
<input type="keyboard" bus="ps2"/> and replace it with <input type="keyboard" bus="virtio"/>.2. Find the line
<input type="mouse" bus="ps2"/> and replace it with <input type="mouse" bus="virtio"/>.3. Click on Apply to save the changes.
STEP 4: Test Input on Host and Guest
1. Start the macOS VM and test swapping control of your keyboard and mouse between the Host and Guest by pressing both the left and right control keys at the same time.
It's strongly recommended to use the Virtio input for vdev passthrough. However, for whatever reasons, if you're unable to use either Keyboard or Mouse via evdev, or only either one of them is working under macOS, then its advised to use the default PS/2 for the inputs. As macOS does not support PS/2 input device natively, you'll have to add a PS/2 drivers to enable the input. To enable the PS/2 input, follow the steps below:
1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
2. Switch switch to XML tab.
3. Remove the following block:
XML:
<input type='mouse' bus='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
</input>
<input type='keyboard' bus='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0f' function='0x0'/>
</input>
5. Download VoodooPS2Controller.kext.
6. Copy VoodooPS2Controller.kext to EFI/OC/Kexts directory.
7. Open your config.plist and add the VodooPS2Controller.kext entries.
8. Disable or Remove the VoodooPS2Trackpad.kext entry from the config.plist if the system is a Desktop.
9. Save config.plist.
10. Unmount the Virtual Bootable USB.
NOTES:
By default, press both left and right Ctrl keys at the same time to swap control between the host and the guest.
You can change this hotkeys. You need to set grabToggle variable to one of available combination ctrl-ctrl, alt-alt, shift-shift, meta-meta, scrolllock or ctrl-scrolllock for your keyboard. More information: https://github.com/libvirt/libvirt/blob/master/docs/formatdomain.rst#input-devices
The virtio input devices will not be used until the appropriate drivers are installed on the guest OS. However, QEMU will continue to send key events to the PS2 devices until it detects the virtio input initialization. In addition, if you're worried about the PS2 devices, they cannot be removed as they are an internal function of the emulated Q35/440FX chipsets and its not recommended to remove them by editing the XML. Even if you try to do so, it will be automatically added back by the QEMU itself.
III. 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 preferenceUSB 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. See Mapping USB Ports for more information.
Individual USB Passthrough
For any reason, you are not able to isolate the physical USB Controller or if there is only single USB Controller on the Motherboard 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.
NOTES:
- 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.
iDevice Passthrough
If you have iDevice (iPhone/iPad/iPod) and wish to passthrough it under macOS VM, it can be done using 2 ways.USB OTA
NOTE:
Unlike the regular individual passthrough, you cannot passthrough the iDevice like Bluetooth or other individual USB passthrough due to some limitations and it does not appear in Finder as well.
Checkra1n
Those who are into development and like exploiting the iDevices for development and research purposes, you can do that on the macOS VM as well.
The easiest way is to use a separate USB Controller and passthrough the controller to the macOS VM and the iDevices can be connected to it
Connect the iDevices to the separate USB Controller
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, if it's shared with some other IOMMU groups, it 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.
You can also use USB to Ethernet Adapter.
NIC Controller Passthrough
By attaching the physical (PCIe) or (onboard) dedicated network controller you are able to isolate it, and 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 to this controller 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. Moreover, it will have its own original MAC Address as well. 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. In case the host has multiple NIC(s), you can enable the passthrough using the same technique. 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
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), such as (Intel I225-V) and requires an additional driver for macOS side.
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.NOTES:
- 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
If you're using Aquantia AQC107 and want to passthrough to the macOS VM, enable passthrough and follow the steps below to activate the controller: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.
| Arch | Identifier* | Comment | Find | Replace | Mask | ReplaceMask | MinKernel | Count | Enabled |
|---|---|---|---|---|---|---|---|---|---|
| Any | com.apple.driver.AppleEthernetAquantiaAqtion | CaseySJ - Fix alloc_dma_buffer (including Sonoma) | 4889C741 B8030000 00 | 4889C741 B8130000 00 | F8FFC7FF FFFFFFFF FF | 00000000 00100000 00 | 21.0.0 | 3 | YES |
| Any | com.apple.driver.AppleEthernetAquantiaAqtion | CaseySJ - Fix IOBufferMemoryDescriptor::withOptions | BA000000 00BF0000 0000 | BA000200 00BF1300 0000 | FFFF00FF FFFFF0FF FFFF | 00000000 00001000 0000 | 21.0.0 | 3 | YES |
4. Save config.plist
5. Restart macOS
Aquantia AQC113
AQC113 is an improved version of the existing AQC107 chip. Now coming with high end boards. The process of activating the AQC113 slightly differs than AQC107.
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 and Bluetooth 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, once you enable the WiFi passthrough. One of the reasons why it is recommended to use hardware that has native support under macOS. As WiFi is on the PCIe bus and the BT is on USB Bus, the process is bit different. Following are the steps to enable WiFi passthrough under macOS VM: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 WiFi Controller from the Device list and click on Finish.
You should see a new Network Device listed under the Devices list.
NOTES:
- If you're using macOS Sonoma or above, you will need to patch the system volume using OCLP in order to enable the Broadcom based cards, whether it has a native support or not.
- If you're using a card that requires drivers (.kext) on macOS, you'll need to install the required drivers for the card to function properly, unless there is a native support (driver-free) for the particular card under macOS. The driver can be obtained from the vendor's site or if the community has already a driver, you could use that.
If you're using a card that requires drivers (.kext) on macOS, you'll need to install the required drivers for a proper functioning of the card, unless it has a native support (driver-free) under macOS. The driver can be obtained from the vendor's site or if the community has already a driver, you could use that.
If you're using a card that requires drivers (.kext) on macOS, you'll need to install the required drivers for the proper functioning of the card, unless it has a native support (driver-free) under macOS. The driver can be obtained from the vendor's site or if the community has already a driver, you could use that.
You can also use USB to Ethernet Adapter.
III. Bluetooth
In order to utilize all the functions of a WiFi Card, WiFi alone is not enough. Bluetooth must be passed through as well. As Bluetooth is on USB protocol, you can either passthrough the Bluetooth device alone or the whole USB Controller to the macOS VM. Once you have enabled WiFi and Bluetooth, the AirDrop should work normally as bare metal. See USB Passthrough for more information.NOTE: If you are using a WiFi/BT which requires driver for macOS, you must inject it via OpenCore
VI. Audio Passthrough
Although, there is not much use of Audio on a VM and it really does not matter if you don't have Audio device on macOS VM. However, it might be required for some use cases. As after enabling the Graphics passthrough, the audio should work normally using the HDMI/DP. However, there could be possibility that your monitor/TV may not have a built-in or an external speaker connected to it and in such cases, you may need the audio function under macOS VM.After you enable the Graphics passthrough, it can transmit the audio either via HDMI/DP/Type-C and also via Bluetooth once you have enabled Bluetooth on macOS VM. For systems that has onboard USB Audio, it would be really easier to passthrough than buying a separate USB Sound Card which will also occupy one of the physical USB port on the host system.
By default, the Audio support is absent and does not work under macOS VM and it is not shared either. Unless you set up Audio passthrough, you cannot use the audio by any means. There are several ways to get the audio on macOS VM which are described below.
Audio is a must have requirement if you are going to play video files over web. This is because, the playback of flash videos requires an audio device to present, at least on macOS. If an audio device is not present, the video will buffer infinitely.
Although, there is not much use of Audio on a VM and it really does not matter if you don't have Audio device on macOS VM as after enabling the Graphics passthrough, it can transmit the audio either via HDMI/DP/Type-C and also via Bluetooth once you have enabled Bluetooth on macOS VM. However, there could be possibility that your monitor/TV may not have a built-in or an external speaker connected to it and in such cases, you may need the audio function under macOS VM. Especially, when you have to play video files over web. This is because, the playback of flash videos requires an audio device to present, at least on macOS. If an audio device is not present, the video will buffer infinitely.
However, your use case might be different and you may require Audio functionality for your use case.
However, the use case can differ from person to person and it might be required for your case.
Onboard Audio
- If the Audio device requires Device ID spoofing, you'll have to spoof it using either DeviceProperties or SSDT which can be loaded via OpenCore.
USB Audio
For USB Audio, you can either passthrough the USB Audio device alone or the whole USB Controller to the macOS VM and it's really convenient to use. Once you have enabled the passthrough, the audio via USB Sound Card or (Onboard) should work normally as bare metal. See USB Passthrough for more information.Unlike the individual USB device passthrough (such as Bluetooth), the USB Sound Card works absolutely fine on macOS VM without requiring USB Controller passthrough.
Bluetooth Audio
HDMI/DP/Type-C Audio
After you enable the Graphics passthrough, the audio should work normally using the HDMI/DP as bare metal. See Graphics Passthrough for more information.Although after enabling the Graphics passthrough, the Graphics acceleration works fine. However, the DP/HDMI/Type-C does not work as intended and a slight modification is required to enable the DP/HDMI Audio under macOS VM.
1. Enable Graphics passthrough, if haven't already. See Graphics Passthrough for more information.
2. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
3. Find the appropriate/right Graphics PCI Device and click on
XML tab right next to the Details tab to switch to XML editing.4. Add
multifunction="on" after function="0x0" followed by a space in the address type line.Before:
XML:
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</source>
<address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0"/>
</hostdev>
After:
XML:
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</source>
<address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x0" multifunction="on"/>
</hostdev>
5. Click on
Apply to save the changes.6. Now find the right Graphics Audio Device and ensure you're switched to the XML tab.
7. Replace
function="0x0" with function="0x1" in the address type line to match the same function:Before:
XML:
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x01" slot="0x00" function="0x1"/>
</source>
<address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0"/>
</hostdev>
After:
XML:
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x01" slot="0x00" function="0x1"/>
</source>
<address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x1"/>
</hostdev>
8. Change the
bus in the address type line to match the same bus the GPU is located on. Basically, the bus must be same for the Graphics and the HDMI Audio of the Graphics Card. In our case, our GPU bus is bus="0x04".Before:
XML:
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x01" slot="0x00" function="0x1"/>
</source>
<address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x1"/>
</hostdev>
After:
XML:
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x01" slot="0x00" function="0x1"/>
</source>
<address type="pci" domain="0x0000" bus="0x04" slot="0x00" function="0x1"/>
</hostdev>
9. Click on
Apply.Here's what it should look like after editing the Graphics and Audio device:
XML:
<!-- Graphics -->
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x01" slot="0x00" function="0x0"/>
</source>
<address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x0" multifunction="on"/>
</hostdev>
<!-- HDMI Audio -->
<hostdev mode="subsystem" type="pci" managed="yes">
<source>
<address domain="0x0000" bus="0x01" slot="0x00" function="0x1"/>
</source>
<address type="pci" domain="0x0000" bus="0x07" slot="0x00" function="0x1"/>
</hostdev>
NOTES:
- The Graphics Audio device's logical address in the
XMLfile must match with that of the Graphics Card. Thesourcepart of either of the devices does not change, but only logical address under the source. - If you're using macOS Mojave or later and have NVIDIA GPU, the HDMI/DP/Type-C Audio may not work with the experimental drivers and there are no solution available at this time.
- macOS does not provide option to control digital audio like DP/HDMI/Type-C. You must use the actual device or its own remote (in case of TV) to control the audio output.
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
The Graphics performs normally as bare metal and the FANs spins during the workload. In addition, it is also possible to disable Zero RPM FAN Mode on Radeon 5000 series cards and newer. See Disabling Zero RPM FAN Mode for more information.
CHAPTER X: Enabling macOS Specific Features
File Vault
The File Vault functions normally as bare metal. See Enabling File Vault for more informationTime Machine
The Time Machine works fine as bare metal. You can either passthrough a physical disk to macOS VM for Time Machine purpose or passthrough a physical USB disk to the macOS VM. Once you have enabled the disk passthrough, all you need to do is configure Time Machine on the designated disk for the backup purpose. You can also select what disk(s) to exclude from Time Machine backups.SideCar
With a supported WiFi and BT hardware, the SideCar function works normally as bare metal, provided that you have a supported iPad and IGPU. However, supported AMD Graphics users can also force the SideCar function. See Enabling SideCar for more information.App Store
As the Ethernet can be shared and a dedicated NIC can be passthrough to the macOS VM, a valid Ethernet device is present and the shared ethernet is recognized by the VirtIO drivers supplied by Apple Inc. All you need is to set the Ethernet as built-in and (en0). As its the first network device, it will be always set as en0. You can simply sign in into your Apple ID via the System Preferences or the App Store itself. Once signed in, you can start using App Store normally as bare metal.iMessage/FaceTime
With a valid ethernet and/or WiFi device and SMBIOS information, the iMessage and FaceTime works flawlessly and the experience is similar to bare metal. The messages can be sent and received promptly. For the FaceTime, you will need to passthrough a Camera via the USB mode to the macOS VM and you can have FaceTime calls as well.AirPlay
Night Shift
Unsupported SMBIOS users can use FeatureUnlock.kext to patch the function.Universal Control
Continuity Mode
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
For high speed interconnect and for scenarios where both, the macOS VM and the host needs to be connected to a high speed connection either for storage solutions or video editing,
is more efficient to deploy Dual port or Quad port Ethernet Adapters instead of using multiple separate Network Adapters for each VM.
For environment where multiple VMs are deployed, this solution can be very efficient as each port on the NIC can be binded
as each VM can occupy one port on the NIC.
Although the macOS has now support for high end NICs, these adapters require VT-d support to work.
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
| Method | Notes |
|---|---|
| Online |
|
| Offline |
|
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
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
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.
| Method | Notes |
|---|---|
| MBR |
|
| GPT |
|
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 withdiskutilcommands 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 DevicesView 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.
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:
|
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 Downloads/InstallAssistant.pkg Downloads/run_offline.sh
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 Version | Command |
|---|---|
| OS X Lion | python3 ./macrecovery.py -b Mac-C3EC7CD22292981F -m 00000000000F0HM00 download |
| OS X Mountain Lion | python3 ./macrecovery.py -b Mac-7DF2A3B5E5D671ED -m 00000000000F65100 download |
| OS X Mavericks | python3 ./macrecovery.py -b Mac-F60DEB81FF30ACF6 -m 00000000000FNN100 download |
| OS X Yosemite | python3 ./macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000GDVW00 download |
| OS X El Capitan | python3 ./macrecovery.py -b Mac-FFE5EF870D7BA81A -m 00000000000GQRX00 download |
| macOS Sierra | python3 ./macrecovery.py -b Mac-77F17D7DA9285301 -m 00000000000J0DX00 download |
| macOS High Sierra | python3 ./macrecovery.py -b Mac-7BA5B2D9E42DDD94 -m 00000000000J80300 download |
| macOS Mojave | python3 ./macrecovery.py -b Mac-7BA5B2DFE22DDD8C -m 00000000000KXPG00 download |
| macOS Catalina | python3 ./macrecovery.py -b Mac-CFF7D910A743CAAF -m 00000000000PHCD00 download |
| macOS Big Sur | python3 ./macrecovery.py -b Mac-42FD25EABCABB274 -m 00000000000000000 download |
| macOS Monterey | python3 ./macrecovery.py -b Mac-E43C1C25D4880AD6 -m 00000000000000000 download |
| macOS Ventura | python3 ./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:
|
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 Utility3. 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 pathView 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:
|
8. Depending on the macOS version you need (See Recovery Table below), type the command.
Recovery Table
| OS Version | Command |
|---|---|
| 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:
|
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 Bootable5. Under Volume label type
EFI6. 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 Drive11. Create a folder named
com.apple.recovery.boot in root of the USB Flash Drive12. 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:
|
7. Depending on the macOS version you need (See Recovery Table below), type the command.
Recovery Table
| OS Version | Command |
|---|---|
| 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:
|
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 DriveCopy
BaseSystem.dmg and BaseSystem.chunklist downloaded above into com.apple.recovery.boot directory.The good thing is, You can also use a physical USB medium to boot the installer, just like Bare metal.
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.
Without tuning your VM, you may experience stuttering, high CPU usage, slow interrupts and I/O. Although, despite of these issues, the VM will still work but nowhere close to the bare metal performance and stability. The sad thing is most of the users would not even bother to fix these issues and tune up the VM to have the right amount of performance and stability.
Why Performance Optimization Matters in Virtualization
1. 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.Server grade systems can support up to 40 cores and up to 6TB of System Memory and up to 8 memory channels per socket. In general, the more CPU cores and memory in the system, the more virtual machines the system can support and each one of them can have a fair amount of performance even when you power up all the virtual machines at once. CPU frequency (core clock) is another critical factor to consider. The faster the frequency, the lesser time it takes to execute a typical workload. In general, higher the CPU clock, higher the performance. It is advised to use historical data to estimate the peak time requirements, for example, how many concurrent virtual machines and virtual CPUs the system commits to meet the service level agreements (SLA). This will help users to determine the number of CPU cores the system requires.
NOTE: If you are dual socket CPU systems and/or for the purpose of GPU transcoding, ensure all power supplies are plugged into the specific motherboard designated power connectors.
I. 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| Settings | Recommended Value |
|---|---|
| Virtualization Technology | Enabled |
| VT-d | Enabled |
| Hyper Threading Technology | Enabled |
| SR-IOV | Enabled |
| IOMMU | Enabled |
| Memory RAS and Performance Configuration/NUMA optimized | Enabled |
| CPU Power and Performance Policy | Performance |
| CPU P State Control/Enhanced Intel SpeedStep Technology | Enabled |
| CPU P State Control/Intel Turbo Boost Technology | Enabled |
| Hardware P States | Native |
| Thermal Configuration | Optimal Cooling/Maximum Cooling |
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.
2. 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.I. Linux Kernel and KVM Tuning
Processor Frequency
III. QEMU Tuning
3. Guest Kernel Tuning
CPU Optimization:
II. Configure CPUs/vCPU Allocation
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 the Virtual Machine from the Virtual Machines list and click on
Open to show the Virtual Machine details.2. Select
CPUs from the left pane.3. 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 leaving at least
2 physical cores (minimum) reserved for the Host for a smooth operation.CPU Overcommit
If you allocate more CPU cores than available on the host, a warning will be displayed as shown below:CPUs can be overcommit when the sum of vCPUs for all guests on the system is greater than the number of the total threads available on the host CPUs. The assigned vCPUs must be less than the number of total threads on the host system to avoid the CPU overcommit situations.
For example, if you have two VMs which have and you have 2 physical cores (4 vCPUs) assigned on the each VM, the total number of the vCPU becomes 8, leaving 2 physical cores (4 threads) reserved for the host machine. When you power on both the VMs, you will have adequate performance on both the VMs and on the host side as well and this wouldn't be an issue even if you need to run multiple VMs at once.
On the other hand, if you allocate 10 vCPUs to one of the VM and 2 vCPUs to the other VM, this can be a problem and when you power on both the VMs at once, the VMs will/one of the VMs will fail to start and/or the host machine will simply restart. However, this won't be an issue if you don't need to run multiple VMs at once. Starting one VM at a time and shutting down the previous VM before you power up the another VM, this can still work.
NOTE: CPU overcommitting can have a negative impact on the overall performance, for example in situations with a heavy or unpredictable guest workload.
III. CPU Mode
The CPU mode is one of the biggest factory in terms of CPU performance and let's accept the fact that the main performance criteria is based on CPU mainly. If you disable all CPU emulation and pass the CPU as-is to the VM using the
host-passthrough mode, then the performance will be as close to bare metal as can be for CPU bound tasks. To set the CPU mode, follow the steps below:1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
2. Allocate the right amount of vCPU as per the host CPU. You can also define CPU Topology and this option will be disabled automatically.
3. Select either host-passthrough or host-model from the Configuration.
4. Click on
Apply to save changes.NOTE: Due to a noticeable bug, when setting the CPU mode as
host-model, the CPU Model choosen by the QEMU is Skylake-Client-IBRS for a Comet Lake 10400 CPU. However, the performance is quite impacted. To be on the safe side and to ensure the performance is as highest as possible, set CPU mode as host-passthrough.Although, host-passthrough and host-model works fine, you may notice lags and stutters on 4K/QHD/DQHD Displays with such CPU mode. Therefore, it is recommended to set the CPU mode as Custom and also pass some arg to the QEMU. This will make the VM much responsive, as close as bare metal with almost 0 difference.
IV. 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, on the guest OS side, it is recommended to configure the CPU topology. Usually, there is no significant difference between how you arrange the number of cores and sockets performance-wise. However, some software applications may require a specific topology setup in order to work.The CPU Topology mainly consists of Sockets, Cores and Threads. For the guest VM, the
sockets, dies and thread attributes of the topology tag must match with your physical CPU. Typically, a consumer motherboard will only have one physical cpu die and socket. As such, the sockets and dies attribute will be 1 in that case. Depending on the motherboard, Workstations and Server grade motherboard can have upto 4 physical sockets.The amount of cores that you want to pass to the VM is configured using the cores attribute. The total amount of cores you want to pass to your particular VM should be less than the actual physical threads. The physical threads are usually referred to as Virtual cores.
Lastly, the threads attributes will depend on the CPU model and specifies how many virtual cores per physical core your CPU has. Typically, the modern CPU supports Hyper-Threading Technology and the threads are usually twice the cores in such case.
1. Select the Virtual Machine from the Virtual Machines list and click on
Open to show the Virtual Machine details.2. 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.3. Configure the socket as per your actual hardware. If you have one physical CPU socket, use
1, and if you have dual, use 2 and so on.4. 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).
5. 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.6. 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.
Irregular Topology
If you use a custom CPU Topology, there are some limitations with the XNU Kernel. Whether you are using Intel or AMD as host CPU, its likely possible that you might have an "odd" core count. macOS doesn't like if the core count isn't a power of 2 (1, 2, 4, 8). With the odd core count, macOS will throw a KP immediately when booting the VM and it will not boot further. There are two ways to fix this issue.Use a regular Topology
The easiest workaround for this issue is to use a regular topology (such as 2, 4, 8 etc).
Fake Topology
Another approach to fix this issue is by faking the toology to prevent kernel panic when booting.
XML:
<vcpu placement='static' current='6'>8</vcpu>
<vcpus>
<vcpu id='0' enabled='yes' hotpluggable='no' order='1'/>
<vcpu id='1' enabled='yes' hotpluggable='yes' order='2'/>
<vcpu id='2' enabled='yes' hotpluggable='yes' order='3'/>
<vcpu id='3' enabled='yes' hotpluggable='yes' order='4'/>
<vcpu id='4' enabled='yes' hotpluggable='yes' order='5'/>
<vcpu id='5' enabled='yes' hotpluggable='yes' order='6'/>
<!-- Fake two cores but disabled. -->
<vcpu id='6' enabled='no' hotpluggable='yes'/>
<vcpu id='7' enabled='no' hotpluggable='yes'/>
</vcpus>
Use odd socket counts
Although not advised, you can use the odd socket counts to fix the irregular topology.
For 6 cores to passthrough, configure the CPU topology as:
Sockets: 2
Cores: 2
Threads: 2
V. CPU Pinning
CPU pinning offers several benefits for the Virtualized environments. CPU pinning ensures that a VM's execution remains confined to the assigned CPU cores or the threads. In other words, it prevents dynamic scheduling across different physical cores. This is important for latency sensitive workloads or applications that need dedicated CPU resources. Furthermore, CPU pinning allows us to allocate specific CPU cores exclusively to a particular VM. Thus, providing isolation from other VMs or processes running on the host machine. This isolation prevents resource circumvention and boosts overall performance.The most significant way to improve the VM performance is to use CPU pinning in conjunction with a host-passthrough CPU mode. The CPU pinning involves setting some cores to be dedicated to virtualization process such as I/O, some for your host and others to be dedicated to your VM. CPU pinning will allocate the CPU cores solely for Guest taks, when the Guest is running. If everything works as expected, the Host will not use the Guest allocated CPU cores. In addition, it is also possible to isolate the cores so that your host does not use them but it may not be necessary for every user as not many users will prefer running anything intensive on the host side while the VMs are running.
First, you have to specify the amount of I/O threads that you will be using in the iothreads tag. Typically, 2 I/O thread would be sufficient. After defining how many threads are dedicated to I/O, you will need to assign it a matching amount of cores. The same goes for the threads assigned to your VM but you will be using the vcpu tag to define how many threads the VM will have.
Before you start with the CPU pinning, you must understand the architecture of the CPU
Generally, most of the users should be fine with the automatic CPU pinning with the VMs, unless you have to run some intensive tasks on the host side while the VMs are running. However depending on your use case, you might need to perform CPU pinning manually for more performance. However, please note that a wrong CPU pinning may result in huge performance loss (depends on how bad the CPU pinning is). This is why most of the users are not even advised to configure it in the first place. Only proceed when you know what you are doing!
VI. CPU Frequency
Processor can operate at a different clock frequency, which is referred to as CPU P-State. Linux Kernel supports CPU performance scaling by the CPUFreq subsystem which include a scaling governor and there are 3 possible settings for the governor:| Governor | Description |
|---|---|
| Performance | Sets the CPU statically to the highest frequency within the borders of scaling_min_freq and scaling_max_freq |
| Powersave | Sets the CPU statically to the lowest possible frequency within the borders of scaling_min_freq and scaling_max_freq |
| Ondemand | Sets the CPU frequency depending on the current system load |
By default, the Linux distribution may set the governor to "powersave" or "ondemand". In order to achieve the best performance, it is recommended to set the governor to " performance" mode.
NOTE: Some users may notice instability or may not be consistent when using the performance mode. Therefore, it is recommended to set the CPU frequency as Ondemand instead of performance.
Check the current CPU Frequency using
Check the clock speed using
Open using your favorite editor
Change powersave to performance for all threads
Save changes to the file
Reboot
Check the current CPU Frequency
Check the clock speed
VII. Huge Page
For memory access intensive VM workloads, enabling Huge Page can reduce TLB (Translation Lookaside Buffer) miss significantly, which aims to improve the performance significantly. Using Huge Pages is one of the techniques to increase the effective of the TLB in the processor, thus improving the overall performance of the VM.Although by enabling Huge Page, its supposed to increase the performance. However, It is recommended to test the configuration thoroughly before rolling it into production, as it may have unexpected effects on certain components of your system or it may not simply benefit in your case due to several factors.
Static Huge Page
While the transparent huge pages work for majority of cases, it can be also allocated statically during boot. However, this should only be needed to make use 1GiB hugepages on machines that support it, since transparent huge pages normally only go up to 2MiB. For example, Intel Xeon 3rd Gen Scalable Family supports up to 1GiB of hugepages. Whereas, most of the consumer grade CPUs only support up to 2MiB only. So enabling huge pages on such machines will not benefit you much and you will not see any significant difference by enabling hugepages on such machines.Static Huge Page can be enabled using a couple of ways in Linux.
Can be enabled using the following syntax: default_hugepagesz=1G hugepagesz=1G hugepages=X
Check Huge Page Size
Before you enable the static huge page, it is recommended to check which huge page size is supported by the platform. This is really necessary as enabling static huge page especially with 1GB in size, where the CPU does not support more than/over 2MiB is not advised due to the adverse affect on the performance/as it can bring a negative impact on the performance/in terms of performance. To verify the huge page support, follow the steps below:1. Open Terminal and execute the following command:
Bash:
if [ "$(cat /proc/cpuinfo | grep -oh pse | uniq)" = "pse" ]
then echo "2048K = OK"
else echo "2048K = NO"
fi
if [ "$(cat /proc/cpuinfo | grep -oh pdpe1gb | uniq)" = "pdpe1gb" ]
then echo "1G = OK"
else echo "1G = NO"
fi
If you see
2048K = OK and 1G = OK in output, your CPU supports both 2MB and 1GB Huge page size.Tip: You can also check 1GB Huge page size using the command below:
Bash:
grep pdpe1gb /proc/cpuinfo
If you see pdpe1gb in output, your CPU supports 1GiB huge pages.
Setting up Huge Pages
There are multiple ways to set up Huge Pages and use it in a KVM environment.
Using sysctl.conf
You can either write the value on the fly to
/proc/sys/vm/nr_hugepages or can directly edit the sysctl.conf. However, writing a value to /proc/sys/vm/nr_hugepages is going to likely take a long time or may fail to allocate the requested amount of pages. The Kernel arg is more suited and will take effect at boot while the memory is not fragmented thus the allocation will be done within seconds.Using Kernel Arg
Over the period of time, the huge pages on due to allocation and fragmentation may become unavailable. To avoid this being an issue, one can let the kernel allocate at boot time. The Kernel arg is more suited and will take effect at boot while the memory is not fragmented thus the allocation will be done within seconds.
Please note that 2MiB Huge page is supported by default.
Calculate Hugepages
Check Memory size using:grep MemTotal /proc/meminfo and note down the value. In our case, its 64GB or kB
For instance, we want to allocate 16GB of the total Memory to the macOS VM as static Hugepages. This equals to . Now to reserve this amount for static huge pages, calculate the number of hugepages, based on the Hugepagesize obtained in the step #1.
Therefore, 64GB/2048kB = 8010. In order to make sure we have enough space for overhead, we can add some % extra space (some say 2%, some say 10%), to be on the safe side, allocating 8800 should be good.
Now that we have obtained how much hugepages to reserve, the next step is to reserve the hugepages
Open Terminal and execute the following command:
Bash:
sudo vim /etc/sysctl.conf
Bash:
vm.nr_hugepages = 8800
Close Terminal
Reboot the host system/machine.
1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
2. Switch to XML Tab to switch to XML editing
3. Find the line currentMemory unit="KiB">XXXXXX</memory>
4. Add the following just below to the line:
XML:
<memoryBacking>
<hugepages/>
</memoryBacking>
Enabling huge pages can boost the VM performance significantly
The whole VM runs on the reserved hugepage and due to this, the performance is really faster
WARNING: Static huge pages lock down the allocated amount of memory, making it unavailable for applications that are not configured to use them. For example, allocating 4GiBs of huge pages on a machine with 8GiB of memory will only leave you with 4GiB of available memory on the host machine even when the virtual machine is not running.
NOTE: The above procedure have some drawbacks but will not necessarily get you a great performance advantage. According to Red Hat benchmarks, you should not expect more than 2% performance gain from this over Transparent Huge Pages.
Transparent Huge Page
The Static huge page needs to be reserved explicitly, which is not very flexible. Linux Kernel also support Transparent Huge page, with which the Kernel can dynamically create, allocate and reclaim huge pages.This is not universal guide and may or may not work for your Linux distribution and enabling some of the performance options which is not meant for your hardware, can result/may bring adverse affect.
free up/release the memory upon shut down.
VIII. Clock Optimization
Disabling HPET can help you to reduce the idle CPU usage. Without the clock optimization, the CPU could rest in the 15% usage even when your VM is running without any workload.In the XML file, find the line
XML:
<clock offset='utc'>
XML:
<clock offset='localtime'>
CPU Name and Model
By default, the CPU Name does not show in macOS VM.1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
2. Allocate the right amount of
vCPU as per the host CPU. You can also define CPU Topology and this option will be disabled automatically.3. Select either
host-passthrough or host-model from the Configuration.4. Click on
Apply to save changes.5. Mount your ESP.
6. Open your config.plist using any XML editor from the
EFI/OC directory.7. Depending on your CPU Core Count you have passthrough, set the Processor Type to
1537 (for 1, 2, 4 and 6 Core CPUs) and 3841 (for 8+ Core CPUs) under PlatformInfo>DataHub-Generic section of your config.plist8. Save your config.plist
9. Restart your system for the applied changes to take effect. It is recommended to reset NVRAM twice at least.
See Fixing Unknown CPU Name for more/further information.
Although cosmetic, its nice to have the CPU model detected on macOS VM, which gives more of a bare metal type experience.
NOTES:
- The Virtual CPU Core must match the Processor Type Core Count.
- The QEMU arg must be host.
QEMU Tuning
Device Model
How you attach the particular device, and how a Virtual Machine access those devices, plays an important/crucial role. Typically, there are two popular models for the virtual machine to access the devices. These are explained below| Models | Description |
|---|---|
| Passthrough Device | Examples are passthrough a Graphics Card, NVMe or a NIC |
| Device Emulation | Examples are Ethernet, Shared Storage and Individual USB Devices |
3. I/O Optimizations/VirtIO Optimizations
Tuning VirtIO
Although using SATA or IDE disk can be used initially for installing macOS, they're not considered ideal for production environment. In order to have the maximum performance, the I/O must be tuned.
Using VirtIO drivers is considered best, is mandatory and is highly recommended to improve the performance for the macOS VM. When used in combination with CPU pinning and IO threads, using the proper drivers will improve the performance of the macOS VM overall. This can fix issues such as application(s) writing data to disk or downloading large files or watching 4K content causing stutter.
By default, QEMU/KVM uses SATA or IDE emulation out of the box. While these controllers offers maximum compatibility, they are not well suited for efficient virtualization. However, two optimized models exists:
Also, it would be nice to use VirtIO from the beginning. As sometimes, changing the driver to VirtIO may not result in gaining significant improvement in terms of performance.
as macOS already includes VirtIO drivers, no extra configuration is needed on the guest OS.
TRIM
Surprisingly, the TRIM function is also supported by the disk images either in RAW or QCOW2 format.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
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 virtualClick 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>
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>
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.
While you can attach partitions like (da1) as in above output, this is not recommended as it may impact the performance of macOS VM.
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 and improves latency.Audio
1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
2. Select Audio from the left pane and click on
Remove to remove the Audio device.You should see the device removed from the Devices list.
Tablet
1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.2. Select Tablet from the left pane and click on
Remove to remove the Tablet.You should see the device removed from the Devices list.
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.
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 platforUnlike 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.Bare Metal Vs KVM Performance
If optimized/tuned properly, the KVM performance is similar to Bare MetalIf you are given a Keyboard, Mouse and a monitor, you really won't be able to tell the difference whether its a bare metal machine or a KVM running macOS as a guest OS.
Including latency and all
Just for a performance comparison, an i3-10100 which is of 4 cores performs way less than in a pure bare metal environment as compared to an i5-10400 with 4 Cores (8 vCPUs) via KVM.
And the KVM running on the same host machine except for the CPU changed to 10400, the performance is really good.
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 IDStuck 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.Unable to map backing store for guest RAM: Cannot allocate memory
LUN Passthrough
Last edited: