Run a macOS Sonoma VM on a Windows PC

Running macOS in a virtual machine is pretty straightforward when doing this on a Mac that is running macOS already as it is easy to get your hands on the installation files. When you want to do this on a x86-based Windows machine it gets a bit more complicated but that is exactly what I will cover in this post. Using a virtual machine with macOS allows you to experiment and play around with different versions of macOS itself without the need for real Apple hardware. It also allows you to have an environment to troubleshoot and diagnose issues with real Mac hardware when you no longer have a working macOS-based machine available.

YouTube Video

If you are interested, I also created a YouTube video from this blogpost. If you prefer classic text, you can just follow the rest of this article:

Introduction

In my previous two posts, I already covered running macOS Sonoma in a virtual machine. This was for devices that had the host system already on macOS, both Intel-based and Apple Silicon-based. In case you don’t have real Mac hardware available, or you do have but it no longer wants to boot into macOS properly, you can instead run macOS in a virtual machine on top of a Windows-based PC.

There are several ways to get to a working macOS VM on top of Windows. In most cases VirtualBox or VMware Workstation (which is now free for personal use) are used as the hypervisor. So I gave both a try but found VMware workstation to be a lot easier and more stable once you go with newer macOS versions.

My goal here was to not use any pre-made macOS installation media that requires another macOS machine but instead to go through the full procedure without the need for a real Mac or counting on a pre-made image made by someone else. The downside of this is that the process is quite a bit longer and requires more data to be downloaded. The good thing is that it has no further dependencies and should work for newer releases as well.

I will go through the steps in this article on a Dell OptiPlex 7060. It is equipped with a Core i7 8700T and 16GB of memory. This should be more than sufficient and lower specs should work fine as well.

Since macOS 11, Big Sur, Apple changed the format in which they distribute the recovery and installation images. With that new format it became a lot harder to extract the required data and create bootable media from Windows, at least without the need for paid tools. Hence I’m going for an intermediate VM with macOS Catalina which we will then upgrade to Sonoma.

Overview of the steps to go through

  1. Download a macOS Catalina recovery image
  2. Convert the recovery image to a VMDK-file
  3. Install VMware Workstation
  4. Modify VMware Workstation to run macOS
  5. Create a VM and Install macOS Catalina
  6. Download the installer and upgrade from Catalina to macOS Sonoma
  7. Install VMware tools on the Sonoma VM
  8. Change VM resolution
  9. Share files between your Windows PC and macOS VM

Part 1) Create macOS Catalina VM

As mentioned above, the first part of the process is to get a working macOS Catalina virtual machine. We will use that one as the base to upgrade from the Sonoma.

Step 1) Download a macOS Catalina recovery image

First we need to get our hands on a recovery image of Catalina. For that we will make use of a script called gibMacOS: https://github.com/corpnewt/gibMacOS. This script allows you to easily download software packages directly from Apple.

After navigating to the Github page, just download the whole repository by clicking on Code > Download ZIP:

Once downloaded, navigate to your Downloads folder, right click the zip-file and choose Extract All…

For convenience, I will also move the extracted folder: gibMacOS-master to the Desktop. This will make it a bit easier to create the commands later but it’s not required if you know what you are doing:

At this point, we can open the gibMacOS-master folder on the desktop and run gibMacOS.bat from there:

This will start gibMacOS but the script will first check if you have Python 3 installed on your system. If it is not, when asked, type “y” to install Python 3 on your system:

This will download and install Python 3 completely automatically and eventually the script will download the latest catalog from the Apple servers and present you with a list of available releases:

We just need to choose a number from this list that suits our needs. As mentioned, we need macOS Catalina so just search for the latest version of Catalina in the list. In my case, and this most likely won’t change anymore, this was 10.15.7 (19H15):

So in order to download that item, we simply need to enter the number the matching number (10) and press enter.

This will start to download the required files from Apple’s servers. We only need a single file: BaseSystem.dmg, for the next step so if you have limited data or simply do not want to wait, you can skip all other files by pressing Ctrl + C when they are downloading. For example with the file InstallESDDmg.pkg, which is several gigabytes in size and we do not need.

If all went well, you should end up with something like this. As you can see, I skipped InstallESDDmg.pkg and RecoveryHDMetaDmg.pkg since we don’t need these:

The downloaded files are now saved in a subdirectory (macOS Downloads) of that gibMacOS-master folder on the desktop as you can see:

The file we need here, as mentioned, is BaseSystem.dmg. For convenience I will rename this file to Catalina-BaseSystem.dmg and also move this one to the desktop:

Time to move to the next step now where we will convert the format of this image to a VMDK-file, which can be used in a virtual machine.

Step 2) Convert the recovery image to a VMDK-file

The downloaded dmg-file cannot be used directly on a virtual machine to boot into macOS recovery. To make it usable, we need to convert it to a disk format that the VM will understand. We can do that using the QEMU tools for Windows.

First download and install the QEMU tools for Windows from: https://qemu.weilnetz.de/w64/. On this link, choose the latest version (in my case qemu-w64-setup-20240423.exe):

Once downloaded, run through the installer:

Now that QEMU is installed we need to open a command prompt and navigate to the desktop (or other location where you put the Catalina BaseSystem.dmg file). Then enter the full path to the qemu-img tool with the following arguments:

C:\Users\Jensd>cd Desktop
C:\Users\Jensd\Desktop>"c:\Program Files\qemu\qemu-img.exe" convert -O vmdk -o compat6 Catalina-BaseSystem.dmg catalina-installer.vmdk

This command will call the qemu-img tool and ask it to covert the Catalina-BaseSystem.dmg file on our desktop to a VMDK-file called catalina-installer.vmdk

If all goes well, you should now end up with that catalina-installer.vmdk file on your desktop:

Step 3) Install VMware Workstation

Now that we have the installation media available that can be used by a virtual machine, we need to download and install VMware Workstation from Broadcom, which recently acquired VMware. You can do this from the following link: https://support.broadcom.com/group/ecx/productdownloads?subfamily=VMware+Workstation+Pro

Get a Broadcom account

Before you are able to proceed to the download, you need to login with a Broadcom account:

If you do not have a Broadcom account yet, you need to create one before you are able to download anything here. If you have one already, you can proceed to the next part (Download VMware Worstation) and login. To register instead, click on the login button top right and click on Register:

Go through the steps here by first entering the code sent to your email-address, followed by your details. If all goes well, you should end up as follows:

Download VMware Workstation

Once you have an account and successfully registered, re-click the link which I provided above: https://support.broadcom.com/group/ecx/productdownloads?subfamily=VMware+Workstation+Pro and log in when asked. In the selection, choose for “VMware Workstation Pro 17.0 for Personal Use (Windows) and click on the latest release that is available:

On the next page, first agree to the terms and conditions, then click the download button right from the software in the list:

Unfortunately it could be that this requires providing some additional personal details as mentioned:

Complete the form and click submit at the bottom of that page:

Finally, you will be above to click the cloud button right from the software in the list and start the download:

Install VMware Workstation

Once the file is downloaded, simply double-click on the installer and run through the setup:

At the end of the installer, just click Finish and move to the next step

Step 4) Modify VMware Workstation to run macOS

As Apple does not allow running macOS on non-Apple hardware, VMware Workstation has some built-in soft restrictions that would prevent you from doing so. While technically the tool is perfectly able to run macOS in a virtual machine. So before we can get our macOS Catalina VM up and running, we will first need to remove these restrictions. To do so we will use another script/tool: https://github.com/paolo-projects/auto-unlocker that can remove the restrictions with a single click.

Navigate to the link provided above and go to the latest release on the right side of the Github page:

Then download that release (in my case Unloccker-v2.0.1-x64.zip):

Once downloaded, go to your Downloads folder, open the downloaded zip file, run the Unlocker executable from there and click on Patch:

If all goes well, you should something like this:

Now we are ready to create our first macOS VM in VMware Workstation.

Step 5) Create a VM and Install macOS Catalina

Finally we create our first virtual machine for macOS. Let’s start VMware Workstation for the first time. When asked, select “Use VMware Workstation 17 for Personal Use” and click Continue:

In VMware workstation, click on Create a New Virtual Machine:

Choose for Typical (recommended) in the first step and choose to install the operating system later:

When choosing the guest operating system, select Apple Mac OS X and set the version to macOS 10.15, which matches with the Catalina recovery image which we downloaded earlier:

Give the VM a name (I chose for macOS) and optionally change the location of the VM. For the disk capacity, increase the size to 100GB:

In the Ready to Create Virtual Machine step, simply click Finish:

Once the VM is created, click on “Edit virtual machine settings” as we will increase some of the resources available to the VM and link that catalina-installer.vmdk file to the virtual machine:

In here, let’s first increase the memory to 8 GB and the CPU core count to 4. The values here depend a bit on how much resources you have on your host machine:

Now, as mentioned above, we need to link the catalina-installer.vmdk file to this VM which we created in step 2. This will be the virtual drive from which we will run recovery to install Catalina on the other virtual drive the first time we’re booting the VM.

Click on Add on the bottom of the dialog and choose for Hard Disk:

Leave the Disk Type as SATA, click Next, choose to “Use an existing virtual disk” and in the next step navigate to the catalina-installer.vmdk file which was the result of step 2:

Click Finish and choose “Keep Existing Format” in case VMware Workstation asks you if you want to convert this virtual disk.

Our VM if almost ready now. But there are a few tweaks which we still need to do by editing the configuration file or VMX-file of the VM. You can find the path to this file in the Virtual Machine Details on the bottom of the window:

To navigate to the directory we can right click on the VM’s name in the left menu and choose for “Open VM directory”:

In the opened directory, find the VMX-file (Type VMware virtual machine configuration), right click on it and open it with notepad:

In the file, the following needs to be changed:

board-id.reflectHost = "FALSE"
ethernet0.virtualDev = "vmxnet3"

At the end of the file, also add these lines:

board-id = "Mac-937A206F2EE63C01"
hw.model.reflectHost = "FALSE"
hw.model = "MacBookPro15,1"
serialNumber.reflectHost = "FALSE"
serialNumber = "C01234567890"

This will expose the virtual machine as if it would be a MacBookPro 15,1. You can play around with these values if desired, just make sure that the board-id and hardware model matches. More info can be found here: https://mrmacintosh.com/list-of-mac-boardid-deviceid-model-identifiers-machine-models/.

Once you made all the required changes, save the file and close it. Then we finally can start the virtual machine which we just created by clicking on “Power on this virtual machine”:

This will boot up the virtual machine for the first time. If all goes well, you should see an Apple logo with a progress bar and eventually the VM will end up in macOS recovery for Catalina:

From here on this will behave exactly the same as it would on real hardware. The first thing we will need to do is format that virtual disk of 100GB which we added during VM creation. So start by going to Disk Utility first. In Disk Utility, make sure to Show All Devices in the menu on the left:

You will now see two virtual drives on the left side. The first one represents that 100 GB virtual drive which is where we want macOS Catalina installed on and the second one is the catalina-installer.vmdk from which we booted now and want to left unchanged.

Select the first drive in the list, double-check it is roughly 100GB in size, choose Erase on top of the window. Give the disk a name and leave the Format and Scheme as in the screenshot. Then click Erase to format that new virtual disk:

Once the process is complete, close Disk Utility and continue with the “Reinstall macOS” option from the main menu in recovery:

Click Continue, accept the license terms, select the virtual disk which we just initialized in Disk Utility and click Install:

From here you can grab a cup of coffee and wait for some time as this will download and install all necessary files for macOS Catalina on the newly formatted virtual disk. In my case this took roughly 30 minutes in total.

If all goes well here, you will be presented with the Welcome wizard. Again, this would be exactly the same as on physical hardware:

Just click through these steps , create a user account and the options you would like to enable or disable. Eventually you should get to see your newly created macOS instance running Catalina:

As you can see here in about this Mac, because those changes we made to the .vmx file of the VM, macOS thinks it is running on a MacBook Pro.

You can use this VM as any other macOS instance running Catalina and if your goal is just to play around with macOS or need macOS to run some specific software or tools, you can go ahead and stop here. The goal for this post though is to run the latest version of macOS: Sonoma. So we will continue with the next step and upgrade this instance to Sonoma instead.

Part 2) Upgrade to macOS Sonoma

In the next part we will use macOS Catalina to get the required files to upgrade to Sonoma and we’ll do some additional changes that make working with macOS in a VM more comfortable.

Step 6) Download the installer and upgrade from Catalina to macOS Sonoma

Since we now have a working macOS instance, as mentioned in the beginning, since Apple changed the way they distribute their OS packages for newer versions, we are now able to use this instance to download the installer for Sonoma. The easiest way to get the installer is through the App Store so let’s launch that:

After starting the App Store, search for “macos sonoma” here and click on View:

Then download the installer by clicking Get on the next page:

Confirm that you want to start the download and once more you will have to be patient as the Catalina VM now will need to download and extract about 14GB of data. For me this took about 30 minutes again:

Once the download is complete and the files got extracted, the installer for macOS Sonoma will automatically start on our Catalina VM. At this point you can choose to clone the VM or take a snapshot in case something would go wrong with the upgrade.

Once you are ready to upgrade, click continue on the installer:

From here you can grab your second cup of coffee as this again takes quite some time. For me this took around 35 minutes on the hardware that I have.

If all goes well here, you eventually should get to login again and see your macOS instance upgraded to macOS Sonoma:

At this point the virtual machine can be used as if it would be a real Mac. But to make things a bit better, let’s go through a few more steps to improve the experience.

Step 7) Install VMware tools on the Sonoma VM

As you probably will notice quite quickly, the VM’s resolution is limited to 1024×768. And although that’s not completely unusable, we can improve that by installing the VMware tools for macOS on this VM. As a bonus this will also improve performance and enable some additional features like shared folders between the Windows host and macOS Sonoma guest VM.

Since we forced VMware Workstation to support macOS, using Auto-Unlocker, it is no longer able to automatically download the VMware tools for macOS. Instead we will manually need to download the ISO file from the Broadcom download site.

Use your browser (on your host) to navigate to: https://support.broadcom.com/group/ecx/productdownloads?subfamily=VMware%20Tools. If requested, log in again using the Broadcom account you created earlier at the beginning of the article.

On the download page for VMware Tools, choose for VMware Tools 11.x (as there are no macOS downloads for version 12.x at the time of writing) and choose the latest version available:

On the next page, agree to the terms and conditions and download the VMware Tools packages for macOS in zip format:

Once downloaded, go to your Downloads folder, right click on the downloaded file and choose “Extract All…”:

Now that we have the ISO file with the tools, we will need to mount it to the Sonoma VM but lets first unlink that catalina-installer.vmdk as well. In order to do that, we need to shut down the VM first:

Once it has completely shut down, go again to “Edit virtual machine settings”:

First we will remove the catalina-installer.vmdk file from this virtual machine as we no longer need it. You can re-use it to create other virtual machine in the future if you like. So select this virtual hard drive in the list, double-check that is is the correct file and size and click remove:

After that, we can map the virtual CD/DVD drive to the ISO-file (darwin.iso) with the VMware Tools. So go to the CD/DVD Drive, choose “Use ISO image file” and Browse to the downloaded darwin.iso file and make sure that the “Connect at power on” checkbox is checked:

Make sure you navigate to your downloads folder and select the darwin.iso file which we extracted from the downloaded zip file earlier:

Click ok to close the VM settings and power on the virtual machine. From macOS now you should see a VMware Tools icon on the desktop. Open this and launch “Install VMware Tools”:

Enter your user’s password and click Allow for the installer to make changes to your VM:

If you get a notification regarding system extensions that are blocked, click “Open System Settings” and Allow the extension from VMware as this is exactly what we want to have:

After entering your password, system settings might ask you to reboot the VM but choose “Not Now” here instead.

Even though I was relatively fast to allow the system extension, in my case the installer for VMware Tools still failed. If this would happen to you as well, just re-run the “Install VMware Tools” from the media that is mounted on the desktop. If all goes well, you should end up like this. Here, choose to Restart the VM:

After the reboot, the VMware tools should be installed and run in the background and you can just eject that ISO which we have mounted in the virtual CD/DVD drive.

Step 10) Change VM resolution

Having the VMware tools installed will allow us to change the fixed resolution (1024×768) which we had in the virtual machine till now. To do so, simply change the size of the window in VMware workstation by dragging out one of the corners:

The VMware Tools will then take care of changing the resolution to fit with the size of the window:

As you can see in the above screenshot, this leads to strange and non-standard resolutions that might cause compatibility issues with certain software. In case you want to set a standard resolution or just specify an exact resolution, open a terminal window and run the following:

sudo /Library/Application\ Support/VMware\ Tools/vmware-resolutionSet 1280 800

You can change the 1280 and 800 in the above command to the horizontal and vertical resolution you want to set:

From here on you can comfortably work with the virtual machine already. Let’s look into something that makes things even more convenient in the next step.

Step 11) Share files between your Windows PC and macOS VM

Although this is an optional step, it can be very handy if you want to share data and files between the guest and host machine. After we installed the VMware tools, it is possible to share folders between the Windows host and the macOS instance running virtually.

To do so, let’s enable this feature and choose which folders to share. In the VM list in VMware workstation, right click your VM and click Settings… or click on VM in the menu bar of VMware workstation and choose Settings…

Go to the Options tab > Shared Folders and select “Always enabled”, then click the Add… button and in the wizard, select a folder to share with the VM. I created a new folder on the desktop called “share” for this but an existing folder with or without files does fine as well:

Finish the rest of the wizard and then back in macOS, perform a reboot to enable file sharing and the shared folders:

After the reboot you can access the shared folders by going to Go > Computer in Finder:

Then open “VMware Shared Folders”:

In here you will find all the folders that you have added when changing the VM settings earlier. In my case this is the new folder on the desktop called share:

Any files that you put in here, either from the Windows host or from the macOS VM will be accessible on both sides. For example, I downloaded and copied a static wallpaper to this folder on Windows and can use it without any issues on the macOS VM:

As you can see this makes it very convenient to exchange files back and forth:

Conclusion

These were quite a lot of steps to go through. From here you can go ahead an play around with the VM as if you would be working on a real Mac.

If you want some more flexibility, you can also easily take snapshots of the VM and return back to them when you break things or simply clone the virtual machine to a 2nd or 3rd instance:

Leave a Reply

Your email address will not be published. Required fields are marked *