{"id":868,"date":"2024-02-26T10:58:43","date_gmt":"2024-02-26T10:58:43","guid":{"rendered":"https:\/\/blog.ngocha.biz\/?p=868"},"modified":"2024-02-26T10:58:43","modified_gmt":"2024-02-26T10:58:43","slug":"build-vms-mac-silicon-with-vagrant","status":"publish","type":"post","link":"https:\/\/blog.ngocha.biz\/?p=868","title":{"rendered":"Build VMs on Mac M1\/M2 with Vagrant &#038; VMware Fusion"},"content":{"rendered":"<p>MAC silicon M1\/M2 chips use ARM architecture which is different from x86 used by Intel processors.<\/p>\n<p>The only solution to run virtual machines on mac silicon is using VMware fusion and Vagrant. I have tried <a href=\"https:\/\/devopscube.com\/virtual-box-tutorial\/\">Virtualbox<\/a> and it doesnt work well and you dont find good ARM based vagrant boxes that has support for Virtual box.<\/p>\n<p><strong>Virtual box  + Vagrant <\/strong>works great on my MAC intel based system. But for my MAC silicon, I use VMware Fusion + vagrant and it works great.<\/p>\n<p>In this blog I will walk you through step by step process of setting up VMware fusion and vagrant to create VMs.<\/p>\n<h2 id=\"prerequisites\">Prerequisites<\/h2>\n<p>Following are the prerequisites for this setup.<\/p>\n<ol>\n<li>macOS (M1\/M2) with admin access.<\/li>\n<li><a href=\"https:\/\/brew.sh\/?ref=devopscube.com\" rel=\"noreferrer noopener\">Homebrew<\/a><\/li>\n<\/ol>\n<h2 id=\"setting-up-vmware-fusion\">Setting Up VMware Fusion<\/h2>\n<p>Since Broadcom acquired Vmware, we have to download it form the Broadcom website.<\/p>\n<p>VMware Fusion pro can be used for free with the personal free licence. Follow the steps given below to setup VMware Fusion.<\/p>\n<p><strong>Step 1:<\/strong> Register for the <a href=\"https:\/\/support.broadcom.com\/group\/ecx\/productdownloads?subfamily=VMware+Fusion&#038;ref=devopscube.com\">Broadcom Account<\/a>. You need this account to download softwares from the Broadcom website.<\/p>\n<p><strong>Step 2:<\/strong> Download and install <a href=\"https:\/\/support.broadcom.com\/group\/ecx\/productdownloads?subfamily=VMware+Fusion&#038;ref=devopscube.com\">VMware Fusion Pro Personal<\/a><\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-268.png\" class=\"kg-image\" alt=\"Vmware Fusion pro download from Broadcom website\" loading=\"lazy\" width=\"739\" height=\"411\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-268.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-268.png 739w\" sizes=\"auto, (min-width: 720px) 720px\"><\/figure>\n<p>Follow the installation wizard. All are self explanatory steps.<\/p>\n<div class=\"kg-card kg-callout-card kg-callout-card-grey\">\n<div class=\"kg-callout-text\"><b><strong style=\"white-space: pre-wrap;\">Important Note:<\/strong><\/b> When asked for licence, choose the personal licence option so that you dont have to provide any licence key.<\/div>\n<\/div>\n<p>You can cancel the final installation method as we will be managing the VMs using Vagrant<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-80-9.png\" class=\"kg-image\" alt=\"cancel the final installation for VMware fusion to use vagrant\" loading=\"lazy\" width=\"632\" height=\"526\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-80-9.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-80-9.png 632w\"><\/figure>\n<h2 id=\"setting-up-vagrant-related-utiltities\">Setting Up Vagrant &amp; Related Utiltities<\/h2>\n<p><a href=\"https:\/\/devopscube.com\/vagrant-tutorial-beginners\/\">Vagrant<\/a> is a open source wrapper utiltiy that interacts with VMWare Fusion to create and manager virtual machines.<\/p>\n<p>Follows the steps to install vagrant and VMWare related vagrant utilties.<\/p>\n<h3 id=\"step-1-install-vagrant-from-the-downloads-page\"><strong>Step 1:<\/strong> Install vagrant from the <a href=\"https:\/\/developer.hashicorp.com\/vagrant\/downloads?ref=devopscube.com\">Downloads page<\/a><\/h3>\n<p>If you have homebrew, you can install it using the following commands.<\/p>\n<pre><code>brew tap hashicorp\/tap\nbrew install hashicorp\/tap\/hashicorp-vagrant<\/code><\/pre>\n<h3 id=\"step-2-install-vagrant-vmware-utility\"><strong>Step 2:<\/strong> Install Vagrant VMware Utility<\/h3>\n<p>Download and install the  <a href=\"https:\/\/developer.hashicorp.com\/vagrant\/install\/vmware?ref=devopscube.com\" rel=\"noreferrer noopener\">VMware Vagrant Utilty<\/a><a href=\"http:\/\/Vagrant VMware Utility\" rel=\"noreferrer noopener\"> <\/a>for MAC<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-108-8.png\" class=\"kg-image\" alt=\"MAC Vagrant VMware Utility \" loading=\"lazy\" width=\"610\" height=\"420\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-108-8.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-108-8.png 610w\"><\/figure>\n<h3 id=\"step-3-install-vmware-provide-plugin-using-the-vagrant-command\"><strong>Step 3:<\/strong> Install VMware Provide plugin using the vagrant command.<\/h3>\n<pre><code>sudo vagrant plugin install vagrant-vmware-desktop<\/code><\/pre>\n<h3 id=\"step-4-restart-your-system\">Step 4: Restart Your System<\/h3>\n<p>Once all the above mentioned installations are done, restart your MAC.<\/p>\n<p>If you dont restart your MAC, you will get the following error.<\/p>\n<pre><code>Vagrant failed to create a new VMware networking device. The following\nerror message was generated while attempting to create a new device:\n\n  Failed to enable device\n\nPlease resolve any problems reported in the error message above and\ntry again.<\/code><\/pre>\n<h2 id=\"building-a-vm-with-vagrant\">Building a VM with Vagrant<\/h2>\n<p>To test the setup, you can clone the <a href=\"https:\/\/github.com\/techiescamp\/kubernetes-certification-guide?ref=devopscube.com\">Kubernetes certification repo<\/a> where we have the Vagrantfile to deploy three VMs.<\/p>\n<pre><code>git clone https:\/\/github.com\/techiescamp\/kubernetes-certification-guide.git<\/code><\/pre>\n<p>cd in the the mac silicon folder. It has a Vagrantfile with <strong>bento\/ubuntu-22.04 <\/strong> vargantbox for arm architecture that deploys three VM&#8217;s. You can modify the VM details in the <strong>settings.yaml <\/strong>file present in the folder.<\/p>\n<pre><code>cd lab-setup\/mac-silicon<\/code><\/pre>\n<p>Now, bring up the VMs using vagrant.<\/p>\n<div class=\"kg-card kg-callout-card kg-callout-card-grey\">\n<div class=\"kg-callout-text\"><b><strong style=\"white-space: pre-wrap;\">Important Note:<\/strong><\/b> Ensure you use sudo with the command. Without sudo, it wont work.<\/div>\n<\/div>\n<pre><code>sudo vagrant up<\/code><\/pre>\n<p>It should bring up three VMs.<\/p>\n<h2 id=\"using-the-vm\">Using the VM<\/h2>\n<p>To login to specific VM, use the node name with ssh.<\/p>\n<p>To get the node names, execute,<\/p>\n<pre><code>$ sudo vagrant status\n\nCurrent machine states:\n\ncontrolplane              running (vmware_fusion)\nnode01                    running (vmware_fusion)\nnode02                    running (vmware_fusion)<\/code><\/pre>\n<p>Use the machine names to ssh. For example,<\/p>\n<pre><code>sudo vagrant ssh controlplane<\/code><\/pre>\n<p>Top stop the VMs,<\/p>\n<pre><code>sudo vagrant halt<\/code><\/pre>\n<p>To bring up the VMs again, run<\/p>\n<pre><code>sudo vagrant up<\/code><\/pre>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>Vagrant is a great utility for running VMs locally on MAC silicon.<\/p>\n<p>You can setup multi node applications, <a href=\"https:\/\/devopscube.com\/setup-kubernetes-cluster-kubeadm\/\">kubeadm kubernetes clusters<\/a> etc that closely replicates the production systems.<\/p>\n<p>If you face any errors during the setup, drop a comment. We will look at it.<\/p>\n<hr>\n<p><strong>Ngu\u1ed3n:<\/strong> <a href=\"https:\/\/devopscube.com\/build-vms-mac-silicon-with-vagrant\/\" target=\"_blank\" rel=\"noopener noreferrer\">Build VMs on Mac M1\/M2 with Vagrant &amp; VMware Fusion \u2014 DevOpsCube<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Source: https:\/\/devopscube.com\/build-vms-mac-silicon-with-vagrant\/<\/p>\n","protected":false},"author":1,"featured_media":869,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-868","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"_links":{"self":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/868","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=868"}],"version-history":[{"count":0,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/868\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/media\/869"}],"wp:attachment":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=868"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=868"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}