Skip to content

Instantly share code, notes, and snippets.

@jetfir3
Last active June 19, 2024 02:36
Show Gist options
  • Save jetfir3/6b28fd279bbcadbae70980bd711a844f to your computer and use it in GitHub Desktop.
Save jetfir3/6b28fd279bbcadbae70980bd711a844f to your computer and use it in GitHub Desktop.
Download VMware Fusion Pro Without a Broadcom Account
#!/usr/bin/env bash
# Download VMware Fusion Pro without Bcom account
#
# By default, the latest verson will be downloaded, extracted and prepped for install
# Use '-k' to keep download file compressed, exiting after download
# Use '-v VERSION' to specify desired version (13.0.0 or higher required)
KEEP_COMPRESSED=false
USER_VERSION=""
while getopts "kv:" opt; do
case $opt in
k) KEEP_COMPRESSED=true ;;
v) USER_VERSION=$OPTARG ;;
*) echo "Usage: $0 [-k] [-v VERSION]" >&2; exit 1 ;;
esac
done
BASE_URL="https://softwareupdate.vmware.com/cds/vmw-desktop/fusion"
macos_requirements_check() {
(("${OSTYPE:6:2}" < 20)) && echo "Warning: VMware Fusion v13.0.0+ requires macOS 11 or higher." >&2 || return 0
}
[[ $(uname | tr '[:upper:]' '[:lower:]') == "darwin"* ]] && macos_requirements_check || KEEP_COMPRESSED=true
version_gte() {
printf '%s\n%s\n' "$1" "$2" | sort -V | head -n 1 | grep -q "^$2$"
}
curl -s --head --fail "${BASE_URL}/" > /dev/null || { echo "Error: Unable to resolve download URL." >&2; exit 1; }
get_latest_version() {
curl -s ${BASE_URL}/ | perl -nle 'print $1 if /href="([0-9]+\.[0-9]+\.[0-9]+)\/"/' | sort -V | tail -n 1
}
VERSION=$([[ -z "$USER_VERSION" ]] && get_latest_version || {
curl -s --head --fail "${BASE_URL}/${USER_VERSION}/" > /dev/null && version_gte "${USER_VERSION}" "13.0.0" && echo "${USER_VERSION}" || {
echo "Error: Version ${USER_VERSION} does not exist or is not supported. Fusion 13.0.0 or higher is required." >&2
exit 1
}
})
BUILD=$(curl -s ${BASE_URL}/${VERSION}/ | perl -nle 'print $1 if /href="([0-9]+)\/"/' | head -n 1)
DOWNLOAD_URL="${BASE_URL}/${VERSION}/${BUILD}/universal/core/com.vmware.fusion.zip.tar"
DOWNLOAD_DIR="${HOME}/Downloads"
DOWNLOAD_FILE="${DOWNLOAD_DIR}/com.vmware.fusion-${VERSION}-${BUILD}.zip.tar"
UNZIP_DIR="${DOWNLOAD_DIR}/com.vmware.fusion-${VERSION}-${BUILD}"
APP_PATH="${UNZIP_DIR}/VMware Fusion.app"
echo "Downloading VMware Fusion v${VERSION} (${BUILD})..."
mkdir -p "${DOWNLOAD_DIR}"
curl -k -q --progress-bar -f -o "${DOWNLOAD_FILE}" "${DOWNLOAD_URL}" || { echo "Error: Download failed." >&2; exit 1; }
${KEEP_COMPRESSED} && { echo -e "\nFinished. Downloaded file location: ${DOWNLOAD_FILE}"; exit 0; }
echo "Extracting tar..."
mkdir -p "${UNZIP_DIR}"
tar -xf "${DOWNLOAD_FILE}" -C "${UNZIP_DIR}" || { echo "Error: Extraction of tar file failed and may be corrupt." >&2; echo "Downloaded file location: ${DOWNLOAD_FILE}" >&2; rm -rf "${UNZIP_DIR}"; exit 1; }
echo "Extracting zip..."
unzip -q "${UNZIP_DIR}/com.vmware.fusion.zip" "payload/VMware Fusion.app/*" -d "${UNZIP_DIR}"
echo "Cleaning up..."
mv "${UNZIP_DIR}/payload/VMware Fusion.app" "${APP_PATH}"
xattr -dr com.apple.quarantine "${APP_PATH}" &>/dev/null
rm -rf "${DOWNLOAD_FILE}" "${UNZIP_DIR}/com.vmware.fusion.zip" "${UNZIP_DIR}/descriptor.xml" "${UNZIP_DIR}/payload" 2>/dev/null
LICENSE_FILES=$(ls -1 /Library/Preferences/VMware\ Fusion/license-fusion* 2>/dev/null)
[[ -n "${LICENSE_FILES}" ]] && {
echo -e "\nNotice: Existing license file(s) found.\nDeletion is required if converting to \"Free for Personal Use\" model.\nTo remove:" >&2
for LICENSE_FILE in "${LICENSE_FILES}"; do
echo "sudo rm \"${LICENSE_FILE}\"" >&2
done
}
echo -e "\nFinished. You can now move the app into the desired location.\nVMware Fusion.app location: ${APP_PATH}"
@jetfir3
Copy link
Author

jetfir3 commented Jun 18, 2024

  • Run script to download without sign-up
  • Use -k to keep download file compressed, exiting after download
  • Use -v VERSION to specify the desired version (13.0.0 or higher required)

Run directly with:

bash <(curl -sSL https://gist.github.com/jetfir3/6b28fd279bbcadbae70980bd711a844f/raw/download_fusion.sh)

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