VM Setup for Mac OS M1/M2/M3

VM Setup for Mac OS M1/M2/M3

Setting up a VM on Mac OS M1/M2/M3 has been a bit of a challenge. To save you some time, I'll provide a streamlined method that I’ve refined through my own experience.

We're setting up a basic virtual machine (VM) using two essential tools:

  1. VMware Fusion: This hypervisor will allow us to run and maintain the VM. While it provides the necessary environment, using VMware Fusion alone means you'll need to handle the setup and configuration manually.

  2. Vagrant: This automation tool simplifies the process of configuring and managing VMs, streamlining your workflow.

Operating System Choices for the VM

  • Ubuntu: A user-friendly Linux distribution.

  • CentOS/Fedora: Reliable Linux distributions, with CentOS known for stability and Fedora for its cutting-edge features.

Follow the steps below to create your VM.

  1. Install rosetta - its a tool which helps you run x86 based apps on arm CPU

    Open terminal and execute below command

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

  2. Install vagrant with homebrew - Automation Tool.

    Open terminal and execute below command brew

    install vagrant

  3. Create an account on Broadcom Open the link in the browser and click on register. https://support.broadcom.com

    VMware was acquired by Broadcom, so all the tools we need to get it from here only.

    1. After logging in, on the left side of the navbar click on - VMware Cloud Foundation

    2. Click on My Downloads, and select VMware Fusion>Select VMware Fusion 13 Pro for Personal Use>Download. PS. make sure you select the T&C.

    3. Complete the download.

  4. Make sure you give it the Accessibility access.

  5. Now we need to download some Plugins

    1. Installing vagrant VMware provider - So that Vagrant knows that we need to use these VMware tools.

      Open terminal and execute below command

      brew install --cask vagrant-vmware-utility

    2. Install vmware plugin for vagrant

      Open terminal and execute below command.

      vagrant plugin install vagrant-vmware-desktop

    3. Create folder for ubuntu vm

      Open terminal and execute below command.
      mkdir -p Desktop/vms/ubuntu
      cd Desktop/vms/ubuntu

    4. Create a Vagrant file

      vim vagrantfile

    5. Click on button ‘i’, to get into insert mode of the file.

    6. Now just Copy Paste the below comands

      Vagrant.configure("2") do |config|

      config.vm.box = "spox/ubuntu-arm"

      config.vm.box_version = "1.0.0"

      config.vm.network "private_network", ip: "192.168.56.11"

      config.vm.provider "vmware_desktop" do |vmware|

      vmware.gui = true

      vmware.allowlist_verified = true

      end

      end

      and then hit ‘esc’, write ‘:wq’, and hit ‘enter’ - this will save and exit.

    7. Bring up vm Make sure in the terminal, you are in the same folder where Vagrantfile is created.

      1. vagrant up

  1. Entering the VM

    vagrant ssh

  2. Now exit the VM.

    exit

  3. Powering off the VM.

    vagrant halt

  4. Destroy the VM.

    vagrant destroy

If we want to create the VM again, we can just write vagrant up, and it will create the VM again.

This should cover everything you need to get your VM up and running smoothly!