Install Tableau Desktop
Summary
This script will install the latest version of Tableau Desktop.
Script Content
#!/bin/bash
cd "/Library/Application Support/JAMF/tmp"
# Update variables. These shouldn't need to change for each update
dmgname="TableauDesktop.dmg"
pkgname="Tableau Desktop.pkg"
apptoreplacerunningname="Tableau"
# Determine CPU architecture for download
arch=$(/usr/bin/arch)
if [ "$arch" == "arm64" ]; then
dmglink="https://www.tableau.com/downloads/desktop/mac-arm64"
echo "Running process to download arm64 version"
else
dmglink="https://www.tableau.com/downloads/desktop/mac"
echo "Running process to download x86_64 version"
fi
# Download DMG
curl -L -o $dmgname "$dmglink"
# Mount DMG
hdiutil mount -nobrowse $dmgname
# Grab the name of the mounted .dmg as it changes with each version
dmgmountedname=`ls /Volumes | grep "Tableau"`
echo "The DMG mounted is: $dmgmountedname"
# Grab the name of the currently installed Tableau version, if present, as it changes with each version.
cd "/Applications"
apptoreplace=`ls | grep "Tableau"`
# If Tableau Desktop is already installed, remove it prior to installing the latest version.
if [ "$apptoreplace" != "" ]; then
echo "The currently installed Tableau application is: $apptoreplace"
# Kill the app if it is running
echo "Killing the app if it is running..."
killall -Kill "$apptoreplacerunningname"
echo "Removing /Applications/$apptoreplace prior to installing..."
rm -rf "/Applications/$apptoreplace"
else
echo "No existing versions of Tableau Desktop detected."
fi
# Install the PKG from the DMG
sudo installer -pkg "/Volumes/$dmgmountedname/$pkgname" -target /
# Unmount the DMG
hdiutil unmount "/Volumes/$dmgmountedname"
# Remove the downloaded DMG
cd "/Library/Application Support/JAMF/tmp"
rm $dmgname
# Clear out the used variables
unset dmgname
unset dmglink
unset pkgname
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
exit 0
Concluding Comments
This script will install the latest version of the Tableau Desktop application.
