Installing and Setting Up Vagrant on Arm64 MacBook M Chip with VMware Fusion (Free)

This technical guide walks you through installing and configuring Vagrant on a MacBook with an M-chip Arm64 architecture to work seamlessly with VMware Fusion. By following these steps, you’ll set up a robust development environment leveraging Vagrant’s capabilities alongside VMware’s virtualization technology.


Prerequisites

  • MacBook with M chip Arm64 Architecture: Ensure your MacBook is equipped with an arm64 M chip. I tested this with an M3.
  • Broadcom Account: Required for downloading VMware Fusion.
  • Homebrew: Optional, but recommended for managing packages on macOS.

Step 1: Install Vagrant

To install Vagrant, it’s recommended to use the official installation package to obtain the latest version (2.4.3), which resolves known issues present in earlier versions.

  1. Download Vagrant Installer: Visit the Vagrant Downloads page and download the macOS installer for version 2.4.3.
  2. Install Vagrant: Run the downloaded installer and follow the on-screen instructions to complete the installation.

Note: While Homebrew can install Vagrant, it typically provides version 2.4.2, which has known errors. Installing the latest version directly avoids the need for workarounds.

Step 2: Install VMware Fusion

VMware Fusion is essential for Vagrant to manage virtual machines effectively. Follow these steps to install it:

  1. Access VMware Fusion Downloads: More information is available at Mike Roy’s Blog.
  2. Navigate to Broadcom Support Portal: a. Visit broadcom.com. b. Click on the Support Portal located in the upper right corner. c. Log In or Register:
    • Click Go To Portal to log in.
    • If you don’t have an account, select Register to create a basic Broadcom account. Ensure all fields, especially First Name and Last Name, have more than two letters to avoid verification errors.
    d. Access Downloads:
    • Once logged in, navigate to support.broadcom.com if not redirected automatically.
    • Select VMware Cloud Foundation from the dropdown menu.
    e. Download VMware Fusion:
    • On the left sidebar, click My Downloads.
    • Search for Fusion or Workstation.
    • Select VMware Fusion or VMware Workstation Pro. (Select Fusion for Mac)
    • Choose the Personal Use edition from the dropdown (identical binaries to the commercial version).
    • Select version 17.5.2 or 13.5.2 (or select the latest Fusion version)
    • Download and install the selected version.

Important: Ensure your First Name and Last Name are correctly entered with more than two letters. If verification fails, you may need to create a new Broadcom account with the correct details.

Step 3: Install vagrant-vmware-desktop Plugin

Instead of using the vagrant-vmware-fusion plugin, install the vagrant-vmware-desktop plugin, which supports both VMware Fusion and VMware Workstation.

  1. Install the Plugin: Open your terminal and execute:
   vagrant plugin install vagrant-vmware-desktop
  1. Verify Installation: Ensure the plugin is installed correctly by listing installed plugins:
   vagrant plugin list

You should see vagrant-vmware-desktop in the list. For example: I see vagrant-vmware-desktop (3.0.4, global)

Reference: For more details, visit the vagrant-vmware-desktop GitHub repository.

Step 4: Install Vagrant VMware Utility

The Vagrant VMware Utility is required for Vagrant to interface with VMware Fusion.

  1. Download Vagrant VMware Utility: Access the Vagrant VMware Installation Guide for detailed instructions and download links. This can also be installed via homebrew. However, to get the latest version, install the Vagrant VMware Utility using the package from the site.
  2. Install the Utility: Open the package and click next to finish the installation. It might mention installing the pluging vagrant-vmware-desktop, but you may skip this as we have already completed this step.

Step 5: Configure and Test Vagrant Box

Set up a Vagrantfile to configure and test a Vagrant box compatible with VMware Fusion.

  1. Create a Project Directory:
   mkdir ~/vagrant-test
   cd ~/vagrant-test
  1. Initialize Vagrant Configuration: Create a Vagrantfile with the following content:
   cat > Vagrantfile <<EOF
   Vagrant.configure("2") do |config|
     config.vm.box = "bento/ubuntu-22.04"
   end
   EOF

Note: The bento/ubuntu-22.04 box supports VMware Desktop and arm64 architecture. For more information, visit the HashiCorp Vagrant Cloud.

Step 6: Bring Up the VM and SSH

Start the virtual machine and establish an SSH connection.

  1. Start the VM:
   vagrant up

Expected Output:

   Bringing machine 'default' up with 'vmware_desktop' provider...
   ==> default: Box 'bento/ubuntu-22.04' could not be found. Attempting to find and install...
       default: Box Provider: vmware_desktop, vmware_fusion, vmware_workstation
       default: Box Version: >= 0
   ==> default: Loading metadata for box 'bento/ubuntu-22.04'
       default: URL: https://vagrantcloud.com/api/v2/vagrant/bento/ubuntu-22.04
   ==> default: Adding box 'bento/ubuntu-22.04' (v202401.31.0) for provider: vmware_desktop (arm64)
       default: Downloading: https://vagrantcloud.com/bento/boxes/ubuntu-22.04/versions/202401.31.0/providers/vmware_desktop/arm64/vagrant.box
   Progress: 2% (Rate: 1406k/s, Estimated time remaining: 0:10:08)
   ...
   ==> default: Successfully added box 'bento/ubuntu-22.04' (v202401.31.0) for 'vmware_desktop (arm64)'!
   ==> default: Cloning VMware VM: 'bento/ubuntu-22.04'. This can take some time...
   ==> default: Checking if box 'bento/ubuntu-22.04' version '202401.31.0' is up to date...
   ==> default: Verifying vmnet devices are healthy...
   ==> default: Preparing network adapters...
   ==> default: Starting the VMware VM...
   ==> default: Waiting for the VM to receive an address...
   ==> default: Forwarding ports...
       default: -- 22 => 2222
   ==> default: Waiting for machine to boot. This may take a few minutes...
       default: SSH address: 127.0.0.1:2222
       default: SSH username: vagrant
       default: SSH auth method: private key
       ...
   ==> default: Machine booted and ready!
   ==> default: Configuring network adapters within the VM...
   ==> default: Waiting for HGFS to become available...
   ==> default: Enabling and configuring shared folders...
       default: -- /Users/yourusername/Dropbox/Lilearning/puppet/ExerciseFiles/01_02/01_02_start/test: /vagrant
  1. SSH into the VM:
   vagrant ssh

Sample SSH Session:

   Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-92-generic aarch64)

    * Documentation:  https://help.ubuntu.com
    * Management:     https://landscape.canonical.com
    * Support:        https://ubuntu.com/pro

     System information as of Sun Dec 15 04:48:13 AM UTC 2024

     System load:  0.02734375         Processes:             232
     Usage of /:   12.1% of 29.82GB   Users logged in:       0
     Memory usage: 11%                IPv4 address for eth0: 192.168.184.128
     Swap usage:   0%

   This system is built by the Bento project by Chef Software
   More information can be found at https://github.com/chef/bento
   vagrant@vagrant:~$ exit
   logout

Exit the SSH session by typing exit.

Step 7: View Global Status

Check the status of all Vagrant environments on your machine.

  1. Display Global Status:
   vagrant global-status

Sample Output:

   id       name    provider         state    directory
   -----------------------------------------------------------------------------------------------------------------------
   c31d759  default vmware_desktop   running  /Users/yourusername/vagrant-test/

Note: This command lists all known Vagrant environments. The data is cached and may not be up-to-date. Use vagrant global-status --prune to remove invalid entries.

  1. Interact with Vagrant Machines:
  • Destroy a Specific Machine: vagrant destroy c31d759
  • Navigate to the Machine’s Directory and Manage: cd /Users/yourusername/vagrant-test/ vagrant status

Step 8: Tear Down the Environment

When you’re done with the virtual machine, gracefully shut it down and remove it.

  1. Navigate to the Project Directory:
   cd /Users/yourusername/vagrant-test/
  1. Halt the VM:
   vagrant halt
  1. Destroy the VM:
   vagrant destroy

Confirm the destruction when prompted to remove all resources associated with the VM.

Leave a Reply

Your email address will not be published. Required fields are marked *