Clean my Mac

These notes provide a quick guide on how to clean system junk files on your Mac.

Why clean your Mac?

Regular system cleaning helps:

  • Improve your Mac's performance
  • Free up valuable storage space
  • Remove unnecessary files and applications
  • Maintain system stability

Common areas to clean

  1. User Cache Files
  2. System Log Files
  3. Language Files
  4. User Log Files
  5. Broken Login Items
  6. System Cache Files

1. User Cache Files

  • Why: Created to speed up apps and processes by storing frequently accessed data.

  • Made of: Temporary app data, browser caches, preview thumbnails, and downloaded app components.

  • Stored in: /Library/Caches and /Library/Caches

  • Clear Command:

    rm -rf ~/Library/Caches/* && sudo rm -rf /Library/Caches/*

2. System Log Files

  • Why: Created to track system events, errors, and activities for troubleshooting.

  • Made of: System reports, crash logs, diagnostic reports, and installation logs.

  • Stored in: /var/log and ~/Library/Logs

  • Clear Command:

    sudo rm -rf /var/log/* && rm -rf ~/Library/Logs/*

3. Language Files

  • Why: Stored to support multiple language interfaces in applications.

  • Made of: Localization files (.lproj folders) for unused languages.

  • Stored in: /Applications/[AppName]/Contents/Resources

  • Clear command:

    find /Applications -name "*.lproj" -type d ! -name "en.lproj" ! -name "Base.lproj" -exec rm -rf {} \;

4. User Log Files

  • Why: Created to track user-specific application activities and errors.

  • Made of: App-specific logs, crash reports, and usage data.

  • Stored in: ~/Library/Logs and ~/Library/Application Support

  • Clear command:

    rm -rf ~/Library/Logs/* && rm -rf ~/Library/Application\ Support/*/logs/*

5. Broken Login Items

  • Why: Remnants of uninstalled applications that were set to launch at startup.

  • Made of: Launch agents, daemons, and login item references.

  • Stored in: ~/Library/LaunchAgents and /Library/LaunchAgents

  • Clear command:

    rm -rf ~/Library/LaunchAgents/* && sudo rm -rf /Library/LaunchAgents/*

6. System Cache Files

  • Why: Created by macOS to improve system performance and app loading times.

  • Made of: System-level caches, kernel caches, and framework caches.

  • Stored in: /System/Library/Caches and /Library/Caches

  • Clear command:

    sudo rm -rf /System/Library/Caches/* && sudo rm -rf /Library/Caches/*

Important Notes

  • Always backup your data before running these commands
  • Some of these commands require administrator privileges (sudo)
  • Some system caches will be regenerated automatically after deletion
  • Be careful with these commands as they can affect system performance if not used properly
  • You can manually delete files by navigating to their respective storage locations using Finder (⌘ + Shift + G to enter the path)