Terminal script for compare and delete unused Library folder and files
-
21-01-2021 - |
Question
I am cleaning up my Library from junk on an MacBook Air (MacOS 10.8.4). Over time I have downloaded, installed and deleted Applications (they are no longer in my Applications folder).
However, lots of them (some I no longer have clue what they are) are still in my Library in different places.
The ones I can find and recognize I can delete manually (like Wondershare)...but!
Question: Is there a safe and clean way using Terminal or other application, to compare my Applications folder for installed applications to the Library and delete unused folders and files.
In other words: If the application is NOT in my Applications folder, then it should not be in the Library.
Solution 2
Using the OmniDiskSweeper would work, but i will require me to search and destroy one by one while been very careful what.
Example:
OmniDiskSweeper found 1.5 Gig in Library of the GarageBand that I removed while back using Finders "move to trash".
It looks like the omnidisksweep is the current choice to do it.
OTHER TIPS
Other options:
- Sort
~/Library/Preferences
or~/Library/Containers
by modification date - Enable calculating all sizes and sort folders by size in Finder
for f in ~/Library/Containers/*; do osascript -e "app id \"${f##*/}\"" &> /dev/null || echo $f; done
cd ~/Library/Application\ Support; for d in *; do find "$d" -exec stat -f "%m $d" {} + | sort -n | tail -n1; done | sort -n
cd ~/Library/Preferences; find . -name \*.LSSharedFileList.plist -mtime +30 -delete; ls -rt *.plist | grep -v apple | sed 's/^/rm /'