Skip to content

Instantly share code, notes, and snippets.

Last active August 6, 2022 20:29
Show Gist options
  • Save fnichol/8609348 to your computer and use it in GitHub Desktop.
Save fnichol/8609348 to your computer and use it in GitHub Desktop.
Testing on Mac Platforms with Test Kitchen

Testing Mac Platforms with Test Kitchen

We'll assume an OS X Mavericks (10.9) box here.


You'll need:

  • Vagrant
  • Vagrant's VMware Fusion provider
  • VMware Fusion
  • Packer
  • A local copy of an "Install *.app" for your target OS (10.9 in this case)

Preparing Mac Image

I'm using the timsutton/osx-vm-templates project to create a modified DMG that requires no boot paramters, sort of like a kickstart.

INSTALL_APP="/Applications/Install OS X Mountain"

git clone
cd osx-vm-templates

mkdir dmg
sudo prepare_iso/ "$INSTALL_APP" dmg/

Now you should have a DMG in the dmg/ directory, similar to dmg/OSX_InstallESD_10.9.1_13B42.dmg. We'll remember this artifact with:

cd -

Build a Vagrant Base Box (VMware Only)

I'm using a modifed set of Packer templates in fnichol/packer-templates to create a Vagrant base box very similar in spirit to Chef(corp)'s Bento boxes project. You'll need Packer installed, so if using a Mac:

brew tap homebrew/binary
brew install packer

Now clone the repo, copy in the Mac DMG:

git clone
cd packer-templates

mkdir packer_cache
mv "$MAC_DMG" packer_cache/

You'll need to make a variables JSON in macosx-10.9/variables.json with the DMG name and checksum:

cat <<_JSON_ > macosx-10.9/variables.json
  "iso_url": "../$(ls -1 packer_cache/*.dmg)",
  "iso_checksum": "$(md5 -q packer_cache/*.dmg)"

Run the Packer template:

./bin/build macosx-10.9

This should produce a Vagrant box file in the builds/ directory.


Import Base Box

Now get the base box into Vagrant with:

vagrant box add macosx-10.9 builds/mac-*.box

Add Test Kitchen Configuration

In your project, try a .kitchen.yml like the one below. There are a few things to take note of:

  • You'll need to set the Vagrant provider to vmware_fusion
  • Memory needs to be 2GB minimum or the box won't boot
  • Current I'm using a "forked" that adds support for Mac OS X 10.9 pending an upstream update

Hope this helps you to test against the Mac platform!

name: vagrant
provider: vmware_fusion
memory: 2048
name: chef_solo
- name: macosx-10.9
box: macosx-10.9
- name: macosx-10.8
box: macosx-10.8
- name: default
- recipe[test]
Copy link

Why use shouldn't the omnibus installer do what's needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment