Remove all specified applications?

MacGeek
New Contributor III

I have an application with a very special name that I pushed out to all Macs in the company about seven years ago. The application no longer functions and only creates confusion and support tickets. This application is not going to be in the Applications, Library of System folders but it could be in any users home folder or a custom folder called /Options.

At this time I only need to delete this App in Mojave and several OS versions prior to that so we don't have to deal with the security issues in Catalina and Big Sur.

This sounded very simple when I first started the project but I've tried everything I can think of or seen on the Web with no successful solutions so far. Are there any thought out there on how this might be done with Composer or in Jamf? Thanks!

1 REPLY 1

mm2270
Legendary Contributor III

Ignore this!
Just run a script like the following:

#!/bin/bash

rm -Rfd /Applications/<application_name.app>

Make sure to replace the <application_name.app> with the specific application name and path (and remove the brackets). If the name has spaces in it, you either have to escape the space, or enclose the entire path in double quotes. So one of the following:

rm -Rfd "/Applications/<application name.app>"

or

rm -Rfd /Applications/<application name.app>

Edit: Sorry, my bad! I didn't read clearly enough. You said the application would not be in any of the standard folders.

In this case I suggest using a find operation to locate where the application is, as long as you're certain you know the exact name. If it's going to be somewhere in the user's directory, you can search down that path for it.

find /Users -name "application.app"

You can delete anything the find command locates, but I would be careful with this. Since it's running as root, you really have to be sure it's finding what you expect or it could delete things you didn't intend to. To do that, you'd use something like this.

find /Users -name "application name.app" -exec rm -rf {} ;

Again, test this out and be careful using it. There's no undoing a root rm command.