Installing the latest VMware Tools in OS X VMs with AutoPkg
As part of working with OS X VMs in VMware Fusion and ESXi, I’ve regularly installed the VMware Tools and have even found ways to incorporate their installation into my build process. However, getting the latest VMware Tools installer into my VM building workflow has usually involved at least one manual step or having a system management tool handle the installation for me. I wanted something that was completely automated without needing to also install a system management client. My end goal was that I didn’t have to worry about doing anything; the latest VMware Tools for my OS X VM would just be installed into the VM as part of the build process.
After doing some research and testing, I have a solution that looks like it does just that. For more details, see below the jump.
Update – 5-10-2016: Joe let me know that his script was a fork of Tim Sutton‘s Puppet / Facter installation script, so credit to Tim for the original idea.
My colleague Jesse Peterson had written a VMware Tools provider for AutoPkg, which was designed to download the latest copy of VMware Tools for OS X:
I had already used Jesse’s AutoPkg provider to build AutoPkg recipes to download, uncompress and extract the VMware Tools installer, so I decided to see if I could leverage Joe’s technique with my existing VMwareTools.pkg recipe for AutoPkg. I also wanted to make sure to clean all AutoPkg-related parts from the system, as I didn’t want to leave traces behind on what could otherwise be a completely unconfigured OS X VM. After some work, I have a script which does the following:
- Downloads AutoPkg from GitHub using git.
- Adds the AutoPkg recipe repo containing the VMwareTools .download and .pkg recipes
- Redirects the AutoPkg cache to a temp location.
- Downloads the current release version of VMware Tools for OS X using AutoPkg and extracts the installer package.
- Installs the latest VMware Tools using the AutoPkg-generated installer package.
Once VMware Tools has been installed by the script, the OS X VM where VMware Tools has been installed must be restarted in order to enable VMware Tools’ functionality.
One thing I found in my testing is that git would be needed for this process, so an essential pre-requisite for running this script is installing git.
This can be most easily accomplished by installing Xcode or the Xcode command line tools (CLT). Both will include git, so installing either should work. One gotcha I ran into during my testing is that Xcode / Xcode CLT usually require accepting Apple’s license before you’ll be able to use git, so make sure the license has been accepted prior to running this script.
I’ve posted the script to my GitHub repo at the following address:
This script is also available as a payload-free installer package, stored as a .zip file in the payload_free_installer directory.