If you're a Mac user equipped with an Apple Silicon chip (M1/M2/M3...) and facing challenges setting up a Vagrant infrastructure due to the lack of supported hypervisors, this tutorial is tailored for you. It will guide you through configuring Vagrant to run using VMware Fusion technology as a hypervisor. Simply follow the steps outlined, and should you encounter any issues along the way, feel free to reach out to me for assistance.
Step 1: Install Rosetta
/usr/sbin/softwareupdate --install-rosetta --agree-to-license
Step 2: Install VMware Fusion tech (you will have to create a VMware account)
https://customerconnect.vmware.com/downloads/get-download?downloadGroup=FUS-TP2023
You may also need to provide a license key, you can opt for the free one.
Step 3: Create a symbolic link
ln -s /Applications/VMWare\ Fusion\ Tech\ Preview.app /Applications/VMWare\ Fusion.app
Step 4: Install vagrant (on MacOS)
brew tap hashicorp/tap brew install hashicorp/tap/hashicorp-vagrant
Step 5: Install vagrant vmware utility
https://releases.hashicorp.com/vagrant-vmware-utility/1.0.22/vagrant-vmware-utility_1.0.22_darwin_amd64.dmg
Step 6: Install vagrant plugin
vagrant plugin install vagrant-vmware-desktop
Step 7: Create a Vagrantfile
This configuration will create 2 VMs (master and slave)
mkdir vagrant-project cd vagrant-project touch Vagrantfile cat << EOF > Vagrantfile Vagrant.configure("2") do |config| config.vm.define "master" do |master| master.vm.box = "spox/ubuntu-arm" master.vm.box_version = "1.0.0" master.vm.hostname = 'master' master.vm.provision "docker" master.vm.network :private_network, ip: "192.168.56.101" master.vm.provider "vmware_desktop" do |v| v.allowlist_verified = true v.gui = false v.vmx["memsize"] = "2048" v.vmx["numvcpus"] = "2" end end config.vm.define "slave" do |slave| slave.vm.box = "spox/ubuntu-arm" slave.vm.box_version = "1.0.0" slave.vm.hostname = 'slave' slave.vm.provision "docker" slave.vm.network :private_network, ip: "192.168.56.102" slave.vm.provider "vmware_desktop" do |v| v.allowlist_verified = true v.gui = false v.vmx["memsize"] = "2048" v.vmx["numvcpus"] = "2" end end end EOF
Note: gui parameter is mandatory
Step 8: Now you can run the vagrant program
vagrant up
Additional commands
Check the status of the VMs
vagrant status
Connect to the VMs
vagrant ssh <hostname>
In our example we can use either
vagrant ssh master
Or
vagrant ssh slave
Stop the VMs
vagrant halt
Delete the VMs
vagrant destroy
Top comments (0)