Skip to main content

Run macOS Mojave using Vagrant

·

This tutorial will guide you through the process of running macOS Mojave in a VM using Vagrant. I’ve mainly used this for the development and testing of Ansible playbooks targeted at configuring headless app builders for iOS devices and Macs .

Please note that this only applies to Intel-based Macs. Apple Silicon-based Macs have not been tested.

This tutorial assumes you have a working installation of macOS Mojave or later running on a Mac and that you have VirtualBox and the VirtualBox Extension Pack installed. This tutorial will make use of macinbox by bacongravy.

Since the macOS EULA only allows running macOS VMs on a genuine Mac, you’ll need an iMac , MacBook Air , Mac mini or other Mac.

Install Vagrant #

Install Homebrew and then install Vagrant:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install vagrant

Get the macOS Mojave Installer Application #

Follow this link to go to the Mac App Store and download and install the macOS Mojave Installer.

Get the macOS Vagrant Box Builder #

Install macinbox using gem, the Ruby package manager:

$ sudo gem install macinbox

Create the macOS Vagrant Box #

Create a directory to store your macOS Vagrant-related files and run macinbox to create the VM:

$ mkdir ~/macos-vagrant
$ cd ~/macos-vagrant
$ sudo macinbox # will take a while
$ vagrant init macinbox

Finally, to start the VM with Vagrant, run:

$ vagrant up

To destroy the virtual machine, simply run (while standing in the directory of your Vagrantfile, in our example ~/macos-vagrant):

$ vagrant destroy

Last Words #

When this article was published, macOS Catalina had already been released. I’ll also update the site with instructions on how to run Catalina. I’ll also post a tutorial on using Ansible to configure macOS.

If you’d like to learn more about Vagrant, see the documentation or read a book or two .

Best of luck! 😀

Revision #

2023-08-31 Revised language, added missing description