I recently got a new MacBook Pro (2018) and installed Vagrant 2.1, VMWare Fusion 10, and Homestead. Everything was working fine until it wasn’t literally the next day. I kept getting auto-corrected forwarded ports due to a collision. After trying to fix the problem I got a weird error about a port forwarding collision that appeared to come from VMWare that vagrant could not address. What follows are instructions on how I was able to fix the issue.
The First Try
The normal fix I have for this is to manually edit and remove the appropriate lines from /Library/Preferences/VMWare Fusion/networking
and /Library/Preferences/VMWare Fusion/vmnet8/nat.conf
however this now results in a strange error when reloading the virtual machine about a port forwarding collision. After a ton of investigation and basically sheer luck I’ve come up with a solution to the error.
Oh, vagrant-vmware-utility?
I eventually discovered that the error is related the the operation of the new vagrant-vmware-utility daemon that the Vagrant VMWare Desktop plugin uses to communicate with and configure VMWare. My guess is that the daemon is caching forwarded port details and doesn’t consult VMWare every time like things used to. There’s probably good reason for this but it made tracking this down very difficult especially due to the closed source nature of all of the Vagrant + VMWare-related utilities.
All my information on this is theoretical as I haven’t been able to thouroughly test my theory but this appears to work to solve the issue.
Just tell me how to fix it
# Navigate to the appropriate vagrant
# folder that is having the problems
# Note: The order of these steps is important
vagrant halt
sudo rm -f /opt/vagrant-vmware-desktop/settings/nat.json
sudo killall vagrant-vmware-utility
vagrant up