Skip to content

Latest commit

 

History

History
120 lines (91 loc) · 2.74 KB

File metadata and controls

120 lines (91 loc) · 2.74 KB

🧹 macOS Cleanup Script

A simple shell script to clean up unnecessary files on macOS — including caches, temp files, logs, and leftovers from deleted applications.

This can help:

  • Free up disk space
  • Remove old application data
  • Keep your Mac feeling fresh

📂 Files in This Repo

File Name Description
clean_macos.sh Main cleanup script that runs all cleaning commands in one go
README.md This documentation

⚙️ How It Works

The script runs a series of safe delete commands targeting common locations for temp files, caches, and app leftovers:

  1. Clear User Caches

    rm -rf ~/Library/Caches/*

    Removes cached files created by apps.
    Safe to remove — they’ll be recreated if needed.

  2. Clear Application Support leftovers

    rm -rf ~/Library/Application\ Support/*

    Deletes old app data from apps that may no longer be installed.
    ⚠ If the app is still installed, it will lose its saved data.

  3. Clear Preferences

    rm -rf ~/Library/Preferences/*.plist

    Removes preference files (.plist) from uninstalled apps.
    Be careful — this resets settings if the app is still installed.

  4. Clear Saved Application States

    rm -rf ~/Library/Saved\ Application\ State/*

    Deletes autosave and restore states for apps.

  5. Clear Logs

    rm -rf ~/Library/Logs/*

    Removes log files — safe to delete.

  6. Empty Trash

    sudo rm -rf ~/.Trash/*

    Empties the Trash folder completely.


🚀 How to Use

1️⃣ Clone the repo

git clone https://github.com/<your-username>/<your-repo>.git
cd <your-repo>

2️⃣ Make the script executable

chmod +x clean_macos.sh

3️⃣ Run the script

./clean_macos.sh

You may be prompted for your password (needed for emptying Trash).


💡 Customization

If you don’t want to delete certain files (e.g., Application Support),
simply comment out the line by adding a # at the start:

# rm -rf ~/Library/Application\ Support/*

⚠️ Warnings

  • This script permanently deletes files — they are not recoverable once removed.
  • Make sure to review the commands before running.
  • If you’re unsure about deleting something, comment it out first.

📝 Example Output

🧹 Starting macOS cleanup...
Deleting user caches...
Deleting Application Support leftovers...
Deleting Preferences...
Deleting saved app states...
Deleting logs...
Emptying Trash...
✅ macOS cleanup complete!

📄 License

This project is released under the MIT License — feel free to modify and share.