Skip to main content
Question

Uninstall Teamviewer via Script or Terminal


Forum|alt.badge.img+6

I've been tasked by my IT security department to remove the Teamviewer app from our Macs. The versions range from 7 to 11. Is there a script or Terminal command that can accomplish this?

4 replies

roiegat
Forum|alt.badge.img+16
  • Valued Contributor
  • 412 replies
  • November 21, 2016

There are a couple ways to do this. You can script it just to delete the application:

sudo rm -R /applications/Teamviewer.app

Or you could set it up as a restricted software and have it delete it when it's detected. This option is easier in my book.


Forum|alt.badge.img+9
  • Valued Contributor
  • 131 replies
  • November 21, 2016

also, if you have a test instance of macOS + Composer, you can install it and capture the locations and then create a basic script to remove those paths.

Or setting restrictions should be able to help as well, before or after the removal.


Forum|alt.badge.img+4
  • Contributor
  • 16 replies
  • November 21, 2016

Here is what I use:

#!/bin/sh

if [[ -e /Applications/TeamViewerHost.app ]]; then
#    TVHostV=`defaults read /Applications/TeamViewerHost.app/Contents/Info.plist CFBundleShortVersionString`
#    echo "$TVHostV"
#        if [[ $TVHostV = *"9."* ]]; then
            rm -rf /Applications/TeamViewerHost.app
            echo "TeamViewer found and removed"
            #rm -f /Library/LaunchAgents/com.teamviewer.teamviewer_desktop.plist
            #rm -f /Library/LaunchAgents/com.teamviewer.teamviewer.plist
            rm -f /Library/LaunchAgents/com.teamviewer*
            echo "LaunchAgents removed"
            #rm -f /Library/LaunchDaemons/com.teamviewer.Helper.plist
            #rm -f /Library/LaunchDaemons/com.teamviewer.teamviewer_service.plist
            rm -f /Library/LaunchDaemons/com.teamviewer*
            echo "LaunchDaemons removed"
            #rm -f /Library/Preferences/com.teamviewer.teamviewer9.plist
            rm -f /Library/Preferences/com.teamviewer*
            echo "Preference file removed"
            #rm -f /Library/PrivilegedHelperTools/com.teamviewer.Helper
            rm -f /Library/PrivilegedHelperTools/com.teamviewer*
            echo "Privileged Helper Tool file removed"
#        fi
else echo "No TeamViewer Host found or wrong version"
fi

As you can see I have commented out the specific files, was easier just to add wildcard to the paths.
In the beginning you can also see that I first checked for the version (didn't want to remove the one I had updated), but commented out that as I handled it with a Smart Group instead.


Forum|alt.badge.img+6
  • Author
  • New Contributor
  • 7 replies
  • November 21, 2016

Thanks for the input everyone. Security wants me to proactively remove Teamviewer, but the restricted software policy would be useful too in case users try to reinstall it. I'll give each of these suggestions a try, thanks again.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings