Created
June 8, 2013 17:28
-
-
Save wbs75/5735956 to your computer and use it in GitHub Desktop.
OSX Mtn Lion script to cleanup and repair permissions on Boot Drive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "asl cleanup..." | |
| find . -name '*.DS_Store' -type f -ls -delete >/dev/null | |
| echo "deleting Flash Cache..." | |
| dscacheutil -flushcache >/dev/null | |
| echo 'Cleaning ASL files...\c';sudo -S find -d /var/log/asl -name "AUX*" -exec rm -fr {} \;;sudo -S find -d /var/log/asl -name "*\.asl" -exec rm -fr {} \;;sudo -S find /var/log/DiagnosticMessages/ -name "*\.asl";sudo -S ls -@ailO /var/log/asl /var/log/DiagnosticMessages;echo;echo done. | |
| echo "ls cleanup...." | |
| /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder >/dev/null | |
| echo "deleting root preferences..." | |
| sudo -s ls -@ailOR /private/var/root/Library/Preferences >/dev/null | |
| echo "deleting Saved Application State..." | |
| sudo rm -rf ~/Library/Saved\ Application\ State/* >/dev/null | |
| echo "Emptying Trash...." | |
| sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl >/dev/null | |
| echo "Repairing Disk Permissions..." | |
| diskutil repairPermissions / >/dev/null | |
| echo "Updating shared Cache..." | |
| sudo update_dyld_shared_cache -force >/dev/null | |
| echo "Rebuilding kextcache..." | |
| sudo kextcache -system-prelinked-kernel && sudo kextcache -system-caches >/dev/null | |
| # Reboot | |
| sudo shutdown -r +1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment