Install TeamViewer
Summary
This script will install the latest version of TeamViewer.
Script Content
#!/bin/zsh
cd "/Library/Application Support/JAMF/tmp"
# Update variables. These shouldn't need to change for each update
dmgname="TeamViewer.dmg"
dmglink="https://download.teamviewer.com/download/TeamViewer.dmg"
dmgmountedname="TeamViewer"
pkgname="Install TeamViewer.app/contents/Resources/Install TeamViewer.pkg"
apptoreplace="TeamViewer.app"
apptoreplacerunningname="TeamViewer"
# Download DMG
curl -L -O "$dmglink"
# Mount DMG
hdiutil mount -nobrowse $dmgname
# Kill the app if it is running
killall -Kill "$apptoreplacerunningname"
# Remove the app from the Applications Folder
rm -rf "/Applications/$apptoreplace"
# Install the new version by running the .pkg file
installer -pkg "/Volumes/$dmgmountedname/$pkgname" -target /
# Set the user as the current logged in user
netname=`ls -l /dev/console | cut -d " " -f 4`
chown -R ${netname}:Staff "/Applications/$apptoreplace"
sudo xattr -rc "/Applications/$apptoreplace/"
# Unmount the DMG
hdiutil unmount "/Volumes/$dmgmountedname"
# Remove the downloaded DMG
rm $dmgname
# Clear out the used variables
unset dmgname
unset dmglink
unset dmgmountedname
unset apptoreplace
unset apptoreplacerunningname
unset netname
unset pkgname
exit 0
Concluding Comments
TeamViewer is an essential tool when it comes to remote IT management and support, therefore it is essential to ensure the latest version is always installed to ensure the best usage experience. This script installs latest version.