Skip to content

Bash script to find and safely delete matching .plist launch agents/daemons from common macOS system and user directories when uninstalling or cleaning up apps.

Notifications You must be signed in to change notification settings

andrewli-ca/remove-plist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

macOS Plist Removal Script

A Bash script for safely removing .plist files from common macOS launch directories based on a search string.

Description

This script helps you remove .plist files that match a specified search string from the following macOS system directories:

  • ~/Library/LaunchAgents (User Launch Agents)
  • /Library/LaunchAgents (System Launch Agents)
  • /Library/LaunchDaemons (System Launch Daemons)
  • /Library/StartupItems (Legacy Startup Items)

This can be particularly useful when:

  • Uninstalling applications that leave behind launch agents/daemons
  • Cleaning up old system services
  • Removing unwanted startup items

Usage

First, make the script executable:

chmod +x remove_plists.sh

Then run the script:

./remove_plists.sh <search_string>

Replace <search_string> with the text to match in plist filenames.

Example

To remove all plist files containing "google" in their name:

./remove_plists.sh google

This will search for and remove files like:

  • com.google.keystone.agent.plist
  • com.google.crashreporter.plist
  • etc.

Security Note

This script requires appropriate permissions to remove files from system directories. You must run it with sudo because it accesses system-level directories that require elevated permissions:

sudo ./remove_plists.sh <search_string>

When sudo is required

The script accesses these directories:

  • ~/Library/LaunchAgents - No sudo needed (user directory)
  • /Library/LaunchAgents - sudo required (system directory)
  • /Library/LaunchDaemons - sudo required (system directory)
  • /Library/StartupItems - sudo required (system directory)

Since the script accesses system directories that require root permissions, you should always run it with sudo to ensure it can complete all operations successfully.

Safety Features

  • The script checks if directories exist before attempting operations
  • It only removes files with .plist extension
  • It shows which files are being removed before deletion

Requirements

  • macOS operating system
  • Bash shell
  • File system access permissions for target directories

About

Bash script to find and safely delete matching .plist launch agents/daemons from common macOS system and user directories when uninstalling or cleaning up apps.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages