Mac OS X Cleaning temp files etc.
- Home
- /
- Support Articles
- /
- Mac OS X Cleaning...
If you insist on running any maintenance tasks, you could run these commands in the Terminal:
WARNING! The “sudo rm -f” command is VERY dangerous, and can cause data loss if used incorrectly. Please, PLEASE, ensure that you type the commands listed below correctly, double and even triple check, I will not be held responsible if you hose your system.
1. “User-level” tasks that do not require a restart:
Run maintenance cron tasks
sudo periodic daily weekly monthly
Flush logs under your home directory
cd ~/Library/Logs sudo rm -rf ~/Library/Logs/*
Flush cache under your home directory
rm -rf ~/Library/Safari/Downloads.plist cd ~/Library/Caches sudo rm -rf ~/Library/Caches/*
Flush Directory Service resolver cache (DNS, etc)
dscacheutil -flushcache
Update application pre-binding
sudo update_prebinding -root / -force
Repair disk permissions on boot volume
sudo diskutil repairPermissions /
Log out and back in to finalize the above steps.
2. “System-level” tasks that require a restart:
Clear the global cache database
cd /Library/Caches sudo rm -rf /Library/Caches/*
Flush system cache entries
cd /System/Library/Caches sudo rm -rf /System/Library/Caches/*
Flush LaunchServices Database (helps with multiple “Open With” entries)
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
Flush Apple Type Server (ATS) cache (resolves issues with corrupt fonts some times)
sudo rm -rf `lsof | grep com.apple.ATS/annex.aux \ | grep Finder | cut -c 66-139` sudo rm -rf /private/var/folders/*/*/-Caches-/com.apple.ATS
Repair disk permissions on boot volume
sudo diskutil repairPermissions /
Finally, restart your Mac after completing any system-wide maintenance tasks.