- Joined
- Jul 22, 2018
- Messages
- 8,013
- 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]
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. 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 |
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
requires basic Terminal and command line skills
Install tools/genisomage
Use Disk Utiity to create the Virtual Image. The advantage of this method is that whenever you need to edit the contents of the EFI or the config.plist, you can just mount, edit and then attach it to the VM. No need to create a new disk image unlike TrueNAS or Proxmox, everytime you make any mistake in building the EFI for your hardware. QCOW2
Sonoma direct install/configure bypass installation or copy it manually
The basic hardware compatibility still applies for using macOS on VM.
different URLs have been provided below
Code:
#14.5
https://swcdn.apple.com/content/downloads/32/06/062-01946-A_0PEP7JHIWA/1pfs4xh22555dj51fkep7w06s4eiezh21p/InstallAssistant.pkg
Code:
#macOS Sonoma
https://swcdn.apple.com/content/downloads/32/06/062-01946-A_0PEP7JHIWA/1pfs4xh22555dj51fkep7w06s4eiezh21p/InstallAssistant.pkg
Code:
#macOS Sonoma (14.5)
https://swcdn.apple.com/content/downloads/32/06/062-01946-A_0PEP7JHIWA/1pfs4xh22555dj51fkep7w06s4eiezh21p/InstallAssistant.pkg
simply change the name of the macOS which you are installing
The VMs can be useful in cases, where you want to have multiple Operating Systems together and for beta testing as well.
CHAPTER : Enable Virtualization
The very first step is to set up BIOS to have the Virtualization enabled on your system. This is because there are a few systems that have the option to Enable/Disable the Virtualization in BIOS which affects the functionality when running a Virtual Machine. To enable Virtualization, follow the steps below.1. On your target computer, boot to BIOS. Refer to your user manual for the BIOS Key
2. Enable Virtualization. This is usually present as Intel VT-x or Intel Virtualization Technology and AMD-V option in BIOS.
3. Save & Exit Setup.
STEP 2: Verify Virtualization Status
The next step is to verify whether the virtualization is enabled or not. This step is required in order to ensure you're on the right track and you meet the hardware requirements to run a Virtual Machine. To verify the Virtualization status, follow the steps below.1. Open Terminal and execute the following command:
Bash:
egrep -c '(vmx|svm)' /proc/cpuinfo
If the Virtualization is supported on the target system, the output should be greater than 0.
If you notice that the Virtualization is Disabled, you need to configure the BIOS/UEFI and enable Virtualization. Enabling the Virtualization Technology feature differs from vendor to vendor and the options differ between Intel and AMD. See STEP #1 for more information.
Verify/Check KVM Virtualization
Open Terminal and execute the following command to install cpu-checker package
Bash:
sudo apt install cpu-checker -y
Bash:
kvm-ok
Now that we have verified that our system supports KVM Virtualization, let us proceed and install QEMU.
Install QEMU/KVM
Before you begin to install QEMU, ensure you're using the latest version of the Linux distribution. If not,This step may need to be adapted for your Linux distribution.
2. Update the system package list using:
Bash:
sudo apt update
Open Terminal and execute the following command
Bash:
sudo apt install qemu-system
When prompted, type
Y
and press enter keyAssuming the Terminal Window is still open/running, install virt manager using
Bash:
sudo apt install virt-manager
Once virtmanager is installed, enable it using
Bash:
sudo systemctl enable --now libvirtd
Now start virtmanager using
Bash:
sudo systemctl start libvirtd
You can check the status of virtmanager using
Bash:
sudo systemctl status libvirtd
You should find Virtual Machine Manager under Apps.
Add permissions
Bash:
sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER
sudo usermod -aG input $USER
NOTE: Replace $USER with your actual username.
Close Terminal
Restart your system!
Enable XML Editing
Some of the options cannot be changed directly and to change those, you need to manually edit the XML files. As the XML needs to be edited after creating the VM, it's advised to enable the XML editing for latter use. By default, the XML editing is disabled.1. From Virtual Machine Manager, click on Edit and then select Preferences.
2. Select Enable system tray icon. Whenever you'll want to use Virtual Machine Manager, you can open it directly within one click from the system tray icon instead of opening it from Apps.
4. Select Enable XML editing
5. Click on Close
CHAPTER X: Creating Virtual Machine
Open Virtual Machine Manager from Apps.Click on the icon at the top left corner to launch the Virtual Machine creation wizard. A new dialogue box will appear to add the Virtual Machine.
A Window will pop up. From there, select Manual install.
Set Architecture to x86_x64 under the Architecture options and click on Forward.
Now its time to define the Operating System we are going to install. As KVM does not have option for macOS, type macOS and when prompted, select Generic or unknown OS from the given list and click on Forward.
Set the Memory as 8192MiB. If you have enough memory on the host system, 16248MiB would be preferred. The least would be 8192MiB or 8GiB. For the best performance, 16GiGB or more is recommended.
NOTE: Due to some unknown reasons, the macOS will not boot with less than 8192MB memory.
For macOS Big Sur and later, at least 8GB of memory is recommended.
Set the CPUs to no more than half of the Threads available on the host computer. The virtual core allocation should be always under 50% of the actual physical CPU Cores. Allocating more than 50% of the physical core may slow down the host computer (e.g. i5-10400 is a 6 Core CPU which has 12 Threads so allocating 6 Virtual Cores is under the 50% utilization limit).
From the storage options, select Select or create custom storage and click on Manage.
A window will pop up to browse the image. Click on Browse Local and select the
Virtual USB Disk.img
you created earlier in STEP #X. Once selected, click on Open and then click on Forward.Specify a name for your Virtual Machine. For instance, we'll be using macOS. You can use any name.
Select Customize configuration before install.
Review the summary and click on
Finish
. If you notice that the parameters are not set as recommended, you can still edit the options and then review the Summary and click on Finish.CHAPTER X: Configure Virtual Machine Parameters
Now before you can start the Virtual Machine and proceed with the macOS installation, you'll need to configure a few parameters in order to boot the macOS installer.In order to boot the macOS installer, you still need to configure the Virtual Machine Parameters. To configure the Virtual Machine Parameters, follow the steps below.
Configure Hypervisor
In order to boot the OpenCore, you'll need to disable Secure Boot. By default, the Secure Boot is enabled for security purposes. Follow the steps below to disable Secure Boot.By default, the Chipset and Firmware is set to i440FX and BIOS respectively, which can be fine for a few Operating System and will work fine with no problems. However,
If you want to describe your Virtual Machine, you can enter a description. We'll be using macOS Sonoma for instance.
1. Set Chipset as
Q35
and Firmware as UEFI x86_64: /usr/share/OVMF/OVMF_CODE_4M.fd
and click on Apply
.2. Click on
Begin Installation
and Virtual Machine Manager will create a new Virtual Machine with the parameters you choose. A Virtual Machine should appear in the list of Virtual Machines in the Virtual Machine Manager.3. The VM will be started immediately. Click on down arrow key just left to the power button and select Force off to shut down the Virtual Machine. We still need to configure the Virtual Machine, before you can begin installing macOS.
NOTE: This setting cannot be changed once set.
Configure Network
The Network settings specify the Network Adapter type, MAC Address and the physical network interface for the VM. macOS already includes VirtIO drivers.Select
NIC: XX:XX:XX
from the left pane.Set Network source as
Virtual network 'default': NAT
from the drop down list.Set Device model as
Virtio
from the drop down list. By default, its set as e1000e
.The Mac Address will be automatically generated by default and there shouldn't be a need to change it. You can change it later on by editing the XML file, if required.
Configure Storage
Now that we have added the Boot Disk during the VM creation/ at the time of creating VM, we need to create Virtual Disk for the macOS installation.Click on Add Hardware
From the Storage pane, the default option will be selected
Set the size to 50GiB. You can change the capacity as per your needs. 50GB should be enough to install macOS and keep some files. The drive capacity can expand upto the max size you select here so please keep that in mind. macOS requires minimum 35GiB for the installation. Although the storage size is different for the different macOS versions, on an average, 35GB is minimum requires approximately.
Set Bus type as VirtIO
Click on Advanced options and set Cache mode as unsafe and then click on Finish. A VirtIO disk will be added to the VM.
Configure USB
By default the USB is set as USB 2.Set Model as USB 3 and click on Apply.
Click on the XML tab just right next to the Details tab.
Set port count as 7 instead 15
Configure QEMU Parameters
Although the VM is ready to start, you need to add some parameters as it's required for macOS to ensure the installation is seamless, hassle free. At this point, other OS can boot normally
Lastly, you will need to configure some of the QEMU parameters.
CHAPTER : Installation
Yes, you have waited for a long and its time to nstall macOS now. Excited?
Once everything is set, you're ready to clean install the desired macOS version on KVM/QEMU. Please note that the host computer must be connected to the internet in order to install macOS since the BaseSystem is merely a recovery image and a full macOS installer will be downloaded during the installation. The Operating System is approximately 12GB in size. So if you're using any sort of Mobile Data make sure you have sufficient data, if using a Mobile Data plan.
Installing macOS on a shared Drive
1. Open Virtual Machine Manager App.
2. Select the Virtual Machine you just created and click on ▶ to power on the VM.
3. The installer will load in a while and you'll see the progress with the Apple logo with a progress bar.
4. When at the Recovery screen, select your preferred language and continue.
5. Select Disk Utility and click on Continue.
6. When in Disk Utility, click on View, and then select Show all Devices.
7. Select
Apple Inc. VirtIO Block Media
and use the following parameters to erase the drive:Name: Macintosh HD
Format: APFS
Scheme: GUID Partition Map
NOTES:
- The target disk/partition must be GUID
- APFS format is recommended for High Sierra and Later
- Users who plan to use High Sierra on HDD should use macOS Journaled (HFS+) Format instead of APFS Format.
Installing macOS using Offline Method
Installing macOS on a dedicated separate drive requires SATA/NVMe passthrough. If you plan to go with that route, you'll have to configure the SATA/NVMe passthrough first. Please note that the NVMe limitations may apply as per the motherboard specification due to the number of PCIe lanes. In addition, multiple NVMe(s) can be added, however, for a SATA passthrough, you'll need a separate SATA Controller other than the Motherboard's built-in one. If you're using a Motherboard which has more than one SATA Controller, you can use SATA passthrough.
1. From the ESXi Host Client, select Manage.
2. Select the Hardware Tab and then select PCI Devices.
3. Select the target NVMe and click on Toggle passthrough to enable the passthrough
4. Select the target Virtual Machine in the left pane and click on Edit.
5. Remove the Hard disk 1.
6. Click on Add other device and then select PCI device from the drop-down menu.
7. From the New PCI device section, select the target NVMe from the drop-down list and click on SAVE.
8. Continue with the step #1 as mentioned above. For step #6, just select the target NVMe Disk.
NOTES:
The target disk/partition must be GUID
APFS format is recommended for High Sierra and Later
Users who plan to use High Sierra on HDD should use macOS Journaled (HFS+) Format instead of APFS Format. Users who are attempting to install macOS Sierra and prior, should use HFS+. Either way, APFS will not be available for macOS High Sierra and newer.
8. Once the drive is erased, close Disk Utility.
9. Select Reinstall macOS Sonoma and continue with the options.
10. Now select Macintosh HD and click on Continue.
NOTES:
- Step #8 will format the target disk. Proceed with caution.
- This will take a couple of minutes and will restart at "Less than a minute is remaining". Upon completion, the system will automatically restart. Your Mac will restart to complete the installation.
Here it ends the first phase of the installation.
When the installer reboots, the installer screen will appear and continue the second phase of the installation. During this phase, the installer will install files to your target disk and create a Recovery HD partition. Upon completion, your Mac will automatically restart.
STEP 3: Finishing macOS Setup
After several minutes of waiting and keeping yourself patient, you should see the macOS setup screen. Now it's time to set up the macOS for the first usage with the newly installed macOS.When you're at the welcome screen, continue with the basics options such as Keyboard setup, Network, Computer Account, and Privacy settings. Do not sign in to Apple ID when prompted.
Now the installation is complete! You should be logged in to your Desktop. For newer versions, unless the Graphics acceleration is enabled, it will be all white.
NOTE:
- The macOS performance might be slow during the initial setup as the KVM/QEMU is not optimized yet.
Take Snapshot
Once you complete the macOS setup, it would be good to take a snapshot. If anything breaks during configuring the macOS or while testing out a few things or if the Virtual Machine goes corrupt, you can always head back to the snapshot to restore your previous installation using the Snapshot feature.
1. Select Take Snapshot... from VM>Snapshot menu.
2. Give a desired name to your Snapshot and click on Take Snapshot. You can also add the description to remember the state of the Virtual Machine.
When needed, you can restore the Virtual Machine to a previous working state from VM>Snapshot>Revert to Snapshot option. You can view all the Snapshots and their details using Snapshot Manager or using the shortcut CTRL+M.
If you want to use Snapshots feature, use QCOW2. However, please note that the speed of the QCOW2 disk may detoriate over the period of time.
NOTES:
Snaphosts require at least one writeable qcow2 disk image allocated to the guest.
Snapshots are only supported if all writeable disks imags allocated to thw guest are qcow2 format.
CHAPTER : Post Installation
Although, a bare metal installation might have several things working if you have followed the guide precisely, however, this is not the case with KVM/QEMU. A macOS VM involves a lot more post-install steps such as PCI passthrough by which you can gain the advantage of Graphics acceleration and such. Only a few basic things will work (such as network) and a lot of function and hardware support will lack until you fix them using the post-installation steps covered in this guide, starting with the power management.The post installation has been divided into two sections: (i) Basics; and (ii) Advanced, covering various aspects of the post installation steps.
Auto Start macOS VM
If you want to make the macOS Virtual Machine start automatically, when the host physical machine boots, you can configure such options with the KVM/QEMU. Follow the steps below to auto start macOS VM at power on1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
2. From the left pane, select Boot Options.
3. Select Start virtual machine on host boot-up and click on Apply.
Now every time you start the Host machine, the macOS VM will be automatically started. This way, after the Graphics passthrough, the experience will be almost the same as the bare metal
Install OpenCore to the ESP/Boot without Virtual USB
Booting from the system drive without the use of Virtual USB Disk is one of the important parts of the post-installation. By booting directly off the macOS disk, the boot time is usually faster. To boot macOS without the use of USB, follow the steps below.1. Mount the EFI Partition of your macOS Disk.
2. Open the EFI mounted on the Desktop.
3. Copy the EFI folder to the ESP you just mounted.
4. Once copied, unmount the EFI Partition of your macOS Disk. You can also eject the partition to unmount it.
5. Shut Down.
Now you can start the Virtual Machine without the Virtual USB Disk!
Remove OpenCore Recovery Disk
The Virtual USB Disk is same as physical USB disk and we can't always start with a USB disk every time we boot up the computer. This is not elegant at all and neither it is convenient for us to modify and customize the Virtual disk image everytime you need to make a change in the EFI. In addition, it can increase boot times. Therefore, once the OpenCore is installed to the ESP, it can be removed. The original Virtual USB disk can be used at any time if you encounter issue with the ESP or unable to enter the system for any reason or for the purpose of reinstalling macOS.1. Shut Down the macOS VM.
2. Select the Virtual Machine from the Virtual Machines list and click on
Open
to show the Virtual Machine details.3. From the left pane, select
VirtIO Disk 1
and click on Remove
. A new dialogue box will appear to confirm delete the Disk Device.4. When prompted, uncheck
Delete associated storage files
and click on Delete
.5. Click on
Apply
. The VirtIO Disk 1
should be removed now.You can now start the VM and edit the EFI directly from the ESP, just like a bare metal machine:
NOTES:
- You must install OpenCore prior to removing OpenCore Recovery Disk
- Do NOT delete the OpenCore Recovery Disk as it might be needed when you cannot/fail to boot/if the VM fails to boot for any reason after the modification in the ESP.
To manage the physical host machine wihout any Desktop/monitor connected/to manage seamlessly, you can install a WebGUI to manage the host with more ease.
However, you may further accelerate and improve the macOS performance using VMware Tools after installing it on the guest OS. This will give you the ability to use macOS in full screen.
To further accelerate and improve macOS performance and for a seamless experience, see Chapter for tuning KVM/QEMU.
Part 2
I. Power Management
Unlike the bare metal, the power management matters for VM and has the same importance.
How important the power management is on bare metal, it has the same importance even when running macOS inside Virtual Machine. After all, it helps to achieve the highest available performance when at peak load and consumes less hardware resources when idle to save power.
Luckily, with macOS Monterey and above, the Power Management is native and the Sleep/Wake, Restart and Shut Down functions perform normally. However, if you're on Big Sur or prior, you'll likely need to inject the SSDT (
SSDT-PLUG
or SSDT-PM
) in order to enable the Power Management on the VM.CPU. macOS
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 Power off button from the TrueNAS Host (UI). However, it is always recommended to perform a clean Shut Down within macOS to avoid data loss.The Sleep/Wake, Restart and ShutDown function works normally as bare metal.
works with no issues
works normally as it should
Within macOS. You just have to be a little patient when performing these power related tasks. Sometimes, it can more time than expected.
Server/Workstation grade components offer the flexibility to add more devices and generally have more room for expansion and is power horse.
Although its highly recommended to setup PCI passthrough during post install/installation stage. However, few advanced user may prefer to set it up before installing macOS and that's completely fine as it gives you a real smooth experience.
The Ethernet supports Hotplug like bare metal.
Can i setup Virtualization on a single GPU?
Although, its recommended to use two GPUs (IGPU and dGPU), IGPU for the host and dGPU for the guest, you can still setup Virtualization using a single GPU, provided that its compatible with macOS.
The reason why you want to have two GPUs is because you would want to operate the Host OS on the machine and without a display attached, you cannot even create a VM. However, to overcome this issue, you can use WebUI and everything can fly/easy peasy.
CHAPTER X: PCIe Passthrough
The real adventure begins/starts hereStorage Passthrough
There are ideally 3 ways to passthrough a storage device to the macOS VM which are described below:Controller Passthrough
By attaching the physical disk (NVMe/SATA/SAS SSD/HDD) to the dedicated controller (NVME/SATA/SAS/U.2) you are able to isolate it, no other disks in use by the host are connected to this controller. Bind this particular controller to vfio and use it in macOS VM. This will passthrough both, the controller and the disk (and everything thats attached to this controller), if not in use by the host. This is the most preferred way to passthrough a physical disk along with the controller to the VM, has high performance and is highly recommended. You can call it a real passthrough with no layers in between and the device will act same as in bare metal. In addition, for devices like SATA and/or NVMe, a full set of native functions will be supported such as TRIM, Secure Erase, command queing, etc. This will also bring the real performance and whatever speeds the controller and the disks supports with no limitations on the macOS VM.Physical Disk Passthrough
For any reason, you are not able to isolate the physical disk (NVMe/SATA/SAS SSD/HDD) and the physical disk (NVMe/SATA/SAS SSD/HDD) is attached to a controller with something else in use by the host. Then, pass the disk with by-id, this will create an emulated controller and use the NVMe disk under macOS VM. This is the second preferred choice and does not hurt the performance, faster than SATA. This option should only be used if you're unable to use the first option.Virtual Disk Passthrough
For any reason, you are not able to isolate the physical disk (NVMe/SATA/SAS SSD/HDD) and the physical disk (NVMe/SATA/SAS SSD/HDD) is attached to a controller with something else in use by the host. Then, create a vdisk (virtual disk) on the physical disk (NVMe/SATA/SAS SSD/HDD); this will create an emulated controller and use the vdisk on NVMe/SATA/SAS SSD/HDD under macOS VM. This is the last option if you cannot use either of the two above options. You can call it shared drive. You can still store the VM related files and also use it under VM, a portion of it. The disk performance is not bad, provided that you are using NVMe/as long as you are using NVMe for the Host OS.SATA Passthrough
VirtIO Passthrough
NVMe Passthrough
Please note that you cannot passthrough the disk being used by the host and/or specifically the disk on which the host OS is installed. Doing so will cause/result in immediate crash as soon as you start the macOS VM.
I/We know you all are excited for the passthrough and have waited with so much and are eager to start with the passthrough guide. but let's start with the basic passthrough
HBA and Fiber Channel Passthrough
Although there are not much options and support is limited under macOS, HBA and Fiber Channel is supported but the support is limited. Luckily, if you have such requirements, you can easily passthrough it.
Thunderbolt Passthrough
IGPU passthrough
dGPU passthrough
- AMD
- NVIDIA
GPU Spoof
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.
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 devices and the physical USB device(s) is/are attached to a controller with something else in use by the host. Then, passthrough the USB devices individually, this will create an emulated controller and use the USB device in macOS VM. You can have the USB Devices shared between the Linux Host and the macOS VM (not both at the same time), and a single USB Controller can share different USB Devices as per the need/requirement. With the macOS Virtual Machine, you would need a Keyboard, Mouse, and Bluetooth mainly. Moreover, you will not have to map the USB Ports under macOS and that's another advantage. This is the first preferred choice and highly recommended over the Controller passthrough.1. Select the Virtual Machine from the Virtual Machines list and click on Open to show the Virtual Machine details.
3. Click on
Add Hardware
. A new dialogue box should appear to add the New Virtual Hardware Devices.4. Select
USB Host Device
from the left pane.5. Select the required USB Device (typically Keyboard, Mouse, and Bluetooth) from the Device list you want to passthrough and click on
Finish
.You should see a new USB Device listed under the Devices list.
Once you start the macOS VM, the Keyboard, and Mouse will start working within the OC menu. When we enter the system, we also find that our all shared USB Devices can be recognized normally. After the USB passthrough, we can use the Keyboard and Mouse to operate the macOS Virtual Machine.
NOTE:
- The USB Passthrough supports Hotplug and you don't need to restart and/or shutdown the VM everytime you want to use a USB device in the macOS VM.
- The USB device location may not be persistent across reboots and therefore you will have to remove the USB device again and set it up again.
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.NOTE:
- Due to the unavailability of VT-d under macOS as it is being used by the Linux Host, you cannot drive NICs which require VT-d. This includes several cards from Aquantia (AQC107, AQC113), Mellanox (ConnectX-4 CX4121A), and Intel (I225-V, X710, XL710), etc. For NICs like AQC107, luckily there is a Kernel Patch which can be injected via OpenCore and the NIC can be driven normally as you would on a bare metal machine.
Aquantia AQC107
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
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
XML
file must match with that of the Graphics Card. Thesource
part 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 withdiskutil
commands as you can lose data without a mechanism for recovery if you repartition the wrong disk.
If you're using OS X EL Capitan or prior, Disk Utility cannot be used for MBR partitioning.
1. Insert your USB Flash Drive
2. Open the Terminal and execute the following commands
Bash:
diskutil list
In our case, the output is
As you can see, the USB Flash drive is
To partition,
Bash:
diskutil partitionDisk /dev/disk1 2 MBR FAT32 "OpenCore EFI" 200Mi HFS+J "macOS Installer" R
You'll see the following as an output of the operation:
3. Quit Terminal
(b). Method #2: GPT
1. Insert your USB Flash Drive
2. Open Disk Utility. The Disk Utility is located at
/Applications/Utilities
.3. Click on
View
and then select Show All 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 path/to/InstallAssistant.pkg scripts/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 Utility
3. Click on
View
and then select Show All Devices
.View attachment 6028
4. Select your target USB Flash Drive in the left pane and click on Erase button at the top and a popup will appear.
5. Use the following parameters to erase your drive.
Name: EFI
Format: MS-DOS (FAT)
Scheme: Master Boot Record
View attachment 5862
6. When done, click on Done and close Disk Utility.
View attachment 5863
7. Copy the
com.apple.recovery.boot
folder downloaded in the above step to your USB Flash Drive in Finder. Please ensure that the directory contains BaseSystem.chunklist
and BaseSystem.dmg
files respectively.For Windows users
STEP 1: Downloading macOS
You'll need to have the exact Recovery image of the target OS you want to install. To download the recovery image, follow the steps below.
1. Install the latest Python from the Microsoft Store.
2. Download OpenCore Pkg from the downloads section of this forum.
3. Extract the downloaded file to your Desktop.
4. Move into the OpenCore-0.X.X-RELEASE/Utilities directory
5. Right-click on
macreceovery
folder and select Copy as path
View attachment 4712
6. Open Command Prompt with Administrator Privileges
View attachment 4713
View attachment 4714
7. Type cd and then paste the path you copied earlier in step 5 and then press enter key. The command would be the following
Bash:
cd "C:\Users\Your User Name\Desktop\OpenCore-0.X.X-RELEASE\Utiities\macrecovery"
View attachment 4715
NOTE:
|
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 Bootable
5. Under Volume label type
EFI
6. Under File System select
Large FAT32 (default)
and click on START.View attachment 4718
7. When prompted, click on OK
View attachment 4719
Once erased, you'll see the READY status in Rufus
View attachment 4720
8. When done, click on Close to close Rufus.
9. Now open your USB Flash Drive in Explorer
10. Delete
autorun.ico
and autorun.inf
file from the USB Flash 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 settingsSettings | 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 belowModels | 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: