Script to run deeper maintenance
I have long been a fan of Onyx, though prefer to be a bit more DIY with system cleaning and optimising. So I wrote a Bash script that I am trying to improve for Sierra / High Sierra. Currently I manually clear user and system caches, and reset my profile Firefox once a week - that has a major impact on making my mac more boxfresh.
Any hints of additional commands, better scripting and places to clean would be awesome...?
#!/bin/bash
# rebuild XPC caches
sudo /usr/libexec/xpchelper --rebuild-cache
# rebuild CoreDuet
sudo rm -fr /var/db/coreduet/*
# rebuild Launch Services
sudo /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchS ervices.framework/Versions/A/Support/lsregister -kill -r -seed -domain local -domain system -domain user
# Flush DNS cache and restart mdns
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder
# clear BootCache
sudo rm -f /private/var/db/BootCache.playlist
# update Dyld cache
sudo update_dyld_shared_cache -root / -force
# rebuild Kernel extension caches
sudo touch /System/Library/Extensions && sudo kextcache -u /
# run system scripts
sudo periodic daily weekly monthly
The version I use also has echo statements and &> pipes to /dev/null
Thanks!!
MacBook Air, macOS High Sierra (10.13.4)