Skip to content

Instantly share code, notes, and snippets.

@bsmt
Last active August 29, 2015 13:57
Show Gist options
  • Save bsmt/9552380 to your computer and use it in GitHub Desktop.
Save bsmt/9552380 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Create an OS X Mavericks vagrant box (for VMWare)
# Assumes you have /Applications/Install OS X Mavericks.app, brew, and of course vagrant
# http://grahamgilbert.com/blog/2013/08/23/creating-an-os-x-base-box-for-vagrant-with-packer/
EDITOR="mate -w"
WORKDIR=/tmp/osxvagrant
mkdir -p $WORKDIR
cd $WORKDIR
# install packer
brew tap homebrew/binary
brew install packer
# install vagrant vmware plugin, just 'cuz
vagrant plugin install vagrant-vmware-fusion
# Clone VM template
git clone https://github.com/timsutton/osx-vm-templates.git $WORKDIR/vm-templates
cd $WORKDIR/vm-templates
sudo prepare_iso/prepare_iso.sh "/Applications/Install OS X Mavericks.app" $WORKDIR
echo "Look for the iso_checksum and iso_url keys."
$EDITOR $WORKDIR/vm-templates/packer/template.json
# build it
echo "This is going to take a while..."
cd $WORKDIR/vm-templates/packer
packer build template.json
mv *.box ~/Desktop/
cd && rm -rf $WORKDIR
sudo rm -rf /tmp/veewee*
echo "Done. You can find the box on your desktop."
echo "Add it to vagrant with vagrant box add NAME box.box"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment