-
-
Save BigSully/d488f262733a592b89f8a1d410d27ddf to your computer and use it in GitHub Desktop.
Automate silent installation of VMware Tools for Mac OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 1 = VMware Tools ISO is mounted from vSphere | |
# 2 = Download VMware Tools (assumes you can connect to internet) | |
INSTALL_METHOD=2 | |
# Thanks to Rich Trouton for tip on Tools being available online | |
VMWARE_TOOLS_DOWNLOAD_URL=http://softwareupdate.vmware.com/cds/vmw-desktop/fusion/11.1.0/13668589/packages/com.vmware.fusion.tools.darwin.zip.tar | |
# DO NOT MODIFY BEYOND HERE # | |
VMWARE_TOOLS_INSTALLER_DIR="/Volumes/VMware Tools/Install VMware Tools.app/Contents/Resources" | |
VMWARE_TOOLS_INSTALLER_FILE="VMware Tools.pkg" | |
if [ $EUID -ne 0 ]; then | |
echo "Please run the script with sudo ..." | |
exit 1 | |
fi | |
if [ ${INSTALL_METHOD} == "1" ]; then | |
if [ -d "${VMWARE_TOOLS_INSTALLER_DIR}" ]; then | |
/usr/sbin/installer -pkg "${VMWARE_TOOLS_INSTALLER_DIR}/${VMWARE_TOOLS_INSTALLER_FILE}" -target / | |
echo "Please reboot the system for the installation to complete ..." | |
fi | |
elif [ ${INSTALL_METHOD} == "2" ]; then | |
TMP_DIR=/tmp/osx-vmware-tools | |
mkdir -p "${TMP_DIR}" | |
VMWARE_TOOLS_TAR_FILE=com.vmware.fusion.tools.darwin.zip.tar | |
VMWARE_TOOLS_ZIP_FILE=com.vmware.fusion.tools.darwin.zip | |
VMWARE_TOOLS_ISO_FILE="payload/darwin.iso" | |
cd ${TMP_DIR} | |
# Download VMware Tools from online repo | |
curl -O "${VMWARE_TOOLS_DOWNLOAD_URL}" | |
# Extract the VMware Tools tar file | |
tar -xf "${VMWARE_TOOLS_TAR_FILE}" | |
# Unzip the VMware Tools zip file | |
unzip "${VMWARE_TOOLS_ZIP_FILE}" | |
# Mount VMware Tools ISO (similiar to vSphere/ESXi) | |
hdiutil attach "${VMWARE_TOOLS_ISO_FILE}" | |
# Perform installation | |
/usr/sbin/installer -pkg "${VMWARE_TOOLS_INSTALLER_DIR}/${VMWARE_TOOLS_INSTALLER_FILE}" -target / | |
# Detach mount & clean up | |
hdiutil detach '/Volumes/VMware Tools' | |
rm -rf "${TMP_DIR}" | |
echo "Please reboot the system for the installation to complete ..." | |
else | |
echo "Invalid Selection" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested link and environments:
http://softwareupdate.vmware.com/cds/vmw-desktop/fusion/11.1.0/13668589/packages/com.vmware.fusion.tools.darwin.zip.tar
Esxi7.0.2
macOS Catalina