Skip to main content

Package file removal on computers managed by Jamf Pro

Updated over a week ago

Description

Indexing was a workflow used in Jamf Admin to aid in the removal of installed packages. With Jamf Admin functionality being removed in Jamf Pro 11.4, the recommended method is to remove an application is to use the software publishers own uninstaller which can be deployed from Jamf Pro via policy.

If there is not an uninstaller available, the next best approach is with a Jamf Pro policy using either the Files and Processes command or a Script. Composer can be utilized to document where an installer puts files in order to write the command or script.

⚠️ Exercise caution when using the "rm" command, as it is a very powerful and permanent command. Prior to executing any policies that involve this command, ensure absolute certainty regarding your intention to remove the specified files or directories. Test the command on a computer that mimics a production setup to ensure there are no unexpected consequences.

Using a Jamf Pro Policy to Remove Files

Follow the steps below if you need to use a Jamf Pro policy with the rm command to remove files:

  1. Identifying where files install and how to remove them

    1. Open Composer.

      • It is strongly recommended to do this on a test computer with no other applications running to avoid capturing activity not related to the installer during the snapshot.

    2. Click New.

    3. Select Normal Snapshot.

    4. Fill out the Package Name.

    5. Let the before snapshot complete.

    6. Run the installer.

    7. Click Create Package Source.

    8. Look through the file directory for files related to the install. If there is a large amount of files we will want to create a script. If there is a small amount we can use Files and Processes.

      ⚠️ Note: The installer may edit preferences files used by multiple applications and services that we will not want to remove. Use caution if you see these files in your Composer Snapshot.

  2. (Optional) If you have a large number of files, create a script in Jamf Pro to remove the files by taking the following steps.

    1. In Jamf Pro go to Settings > Computer Management > Scripts.

    2. Click New.

    3. On the general tab, give the script a name.

    4. Click the Script tab, write/paste in your script, and click Save.

  3. Create a policy to remove the files and directories identified in the Composer Snapshot.

    1. In Jamf Pro, click Computers.

    2. Select Policies and click New.

    3. On the General payload:

      • Fill out Display Name.

      • Under Trigger, enable the Recurring Check-in option.

      • For execution frequency, select Once per computer.

    4. Choose one of the following payloads based on how many files there were:

      • If there were a small amount of files:

        1. Select the Files and Processes payload.

        2. Click Configure.

        3. Fill out the Execute Command field with something similar to the following:

          rm -rf /Example/Directory && rm -f /Example/File
          • Note: This is a command used to remove files and directories. Open Terminal and run the 'man rm' command to learn more about the flags. For example, -r is used to remove all the contents found within a directory and -f forces the deletion without prompting the end user.

          • In the command above, replace the example paths with the actual file paths. The && allows an additional file to be removed. Repeat as necessary.

      • If there were a large amount of files and we created a script in the optional step 2:

        1. Select the Scripts payload.

        2. Click Configure.

        3. Select Add to the right of the script that was created earlier.

    5. Click the Scope tab.

    6. Use the Add button to scope this policy to a test computer with the software installed that we want to remove.

      • It is critical to scope this first to a test computer that mimics a production setup as to ensure no critical elements are removed.

    7. Select Save.

Did this answer your question?