Skip to content

Instantly share code, notes, and snippets.

@sbailliez
Last active April 10, 2024 07:51
Show Gist options
  • Save sbailliez/f22db6434ac84eccb6d3c8833c85ad92 to your computer and use it in GitHub Desktop.
Save sbailliez/f22db6434ac84eccb6d3c8833c85ad92 to your computer and use it in GitHub Desktop.
Vagrant and VMWare Tech Preview 21H1 on Apple M1 Pro

Vagrant and VMWare Tech Preview 21H1 on Apple M1 Pro

UPDATE November 20, 2022: VMWare Fusion 13

VMWare Fusion 13 is now released. Read Vagrant and VMWare Fusion 13 Player on Apple M1 Pro for the latest.

Summary

This document summarizes notes taken while to make the VMWare Tech preview work on Apple M1 Pro, it originated from discussions in hashicorp/vagrant-vmware-desktop#22

Created on: November 1, 2021

Updated on: November 20, 2022

Installing Rosetta

First install Rosetta if not already done, this is needed to run x86 code:

/usr/sbin/softwareupdate --install-rosetta --agree-to-license

Installing Vagrant

Install Vagrant via brew or install it manually. The version is important. DO NOT use 2.2.19

brew install vagrant@2.3.0

Installing VMWare Fusion Tech Preview

You will need to create an account on vmware as it needs user and key information that are user specific. The registration process is kinda convoluted. Be careful about passwords as the password needs to be less than 20 characters and there are no error messages for this.

You can download the tech preview via the download page.

Once this is installed you will NEED to create a symlink as the vagrant vmware utility etc.. assumes that vmware is installed in a specific directory and the tech preview is installed in a different one.

ln -s /Applications/VMWare\ Fusion\ Tech\ Preview.app /Applications/VMWare\ Fusion.app

Installing Vagrant VMWare provider

It requires two steps. This is detailed in the documentation but follow the steps below:

It is now available via brew, so you can do

brew install --cask vagrant-vmware-utility

Otherwise, go to Vagrant vmware Utility and download the binary and install it. The direct link is vagrant-vmware-utility_1.0.21_x86_64.dmg.

It needs to be version 1.0.21

Next install the provider:

vagrant plugin install vagrant-vmware-desktop

Create a Vagrant file

Create a file Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "spox/ubuntu-arm"
  config.vm.box_version = "1.0.0"
end

Run vagrant

vagrant up

and then

vagrant ssh

Hopefully this should work and you should find yourself with mostly everything working.

Troubleshooting

I have observed various issues that makes the whole experience unstable or creating conflicts.

"Vagrant encountered an unexpected communications error" after an os update

Everytime macOS install a software update, this will break your vmware utility driver. You will need to reinstall the vmware utility driver as documented above.

Vagrant encountered an unexpected communications error with the
Vagrant VMware Utility driver. Please try to run the command
again. If this error persists, please contact support@hashicorp.com

vagrant 2.2.19 is broken

I have had issues trying to run vagrant 2.2.19. Use 2.3.0

vagrant-vmware provider forwarded ports bound

If you declare forwarding port on your box, for some reasons the provider persists them and keeps it bound in LISTEN state even after you do a vagrant halt.

You can check this using something like:

sudo lsof -i -P | grep LISTEN | grep 'vagrant-v'

You can see the ports are stored in:

cat /opt/vagrant-vmware-desktop/settings/portforwarding.json

To stop the provider use:

sudo launchctl unload -w /Library/LaunchDaemons/com.vagrant.vagrant-vmware-utility.plist

To start it again, use load instead of unload.

nfs exports conflicts

If your vagrant box uses nfs, it seems to pollute the /etc/exports file with duplicate or stale entries over time which will cause vagrant to get angry at you at some point. You may need to prune the entries. It seems related to vagrant#11418

@FrailWords
Copy link

There's a new arm64 version of the image -

  config.vm.box = "bento/ubuntu-22.04-arm64"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment