Building macOS 12.x VMs with packer and Fusion

Starting a new thread for discussion on building macOS 12.x virtual machines with packer and VMware fusion 12.0. macOS 12.0.1 Monterey will be released shortly. My packer template for building these complicated VMs has been updated on github.

For general questions please use this thread. If you have a bug or feature request use github issues.

Thanks,
Blake

1 Like

The previous thread does have some good info so linking here.

1 Like

Just want to say a big Thank You for this repo. I was now able to get a vagrant box out of the configuration and replace macinbox using macOS Monterey.

Just a note to say that I was seeing some issues with starting the box on VMWare on a Mac Mini after building on a MacBook Pro. I think there may be a bug (or dependency?) in the packer vmware plugin as the cores per socket is being set to a value causes issues (seems to be same as number of cpus / cores being configured). I also had to update the model ID and board ID. So if people see boot failures and VMWare refusing to start because of misconfigured CPUs and then check CPU, Socket, and board ID options in the vmx file. Fixed by manually editing the vmx file.

Currently looking replacing the packer user config with a direct vagrant option so this is direct replacement to get a vagrant compatible box.

Once I have this complete I may try to submit a PR from my fork.

2 Likes

Hi @trodemaster — Thanks for publishing the repo.

I notice it mentions this about the M1 series:

“These templates only support x86 platform as Apple has introduced breaking changes with the new Applesilicon platform.”

Do you know what was broken and thus what needs to be fixed for it to work on M1? If yes, you would mind elaborating?

Supporting the new applesilicon architecture is up to the hypervisor vendors and apple. It’s looking like VMware Fusion won’t support macOS guests as apple requires use of their own framework and essentially is not a VMware VM. I have no interest in supporting parallels and qemu support could show up in a year or two.

Board type and CPU settings are all parameterized. Depending on your host hardware you will want to adjust those to match. Also the timing for boot wait can be set using variable file along with it. If the VM is doing random things in non english you need to expand the boot wait time.

Apologies if not clear. I adjusted through the mechanisms you provided but when transferring the resulting image to another machine, VMWare would not run due to a mismatch in a parameter in the vmx file. More an FYI than a criticism. Not clear how the plugin is setting that or whether it has some dependency on the image build machine for the value. I don’t have the message to hand but VMW was complaining about mismatched CPU and socket counts.

Thank you for elaborating.

I was going to ask if you knew if VirtualBox supported the M1 yet or not, but decided to Google first and found that a forum moderator claim there will be no plans to support non-x86 architectures.

Given that I looked around and found UTM which is specific for and supports macOS directly, albeit will require an ARM version of Windows for it to run Windows. And of course it is not yet mature for Windows.

So it looks like when I get time to switch to my new Mac M1 I may have to write a builder plugin for UTM…

Hey so UTM is an interesting project for sure. I found that they have a patched version of qemu posted GitHub - utmapp/qemu: qemu with iOS host support and have been using that on applesilcon for linux VMs. As of now it will not boot macOS on applesilicon. That version of qemu does work with packer directly so no real need to write a new builder.

If qemu gains the ability to boot macOS on applesilicon I will look at supporting that with my packer template. Until then I have been using GitHub - KhaosT/MacVM: macOS VM for Apple Silicon using Virtualization API and just running my config scripts by hand as needed.

A lot of people are just using physical systems on applesilicon for testing now. With erase all settings feature I expect more people to start using that as it provides snapshot style reverting to clean state on physical systems.

1 Like

@trodemaster

Whoa!

Thanks for sharing github.com/KhaosT/MacVM; I will definitely be looking more into that.