⚡ Mac Optimizer Pro
Give your Mac a deep clean and tune-up, automated. Here's exactly what optimize_pro.sh does, step by step.
Overview
optimize_pro.sh runs eight maintenance functions in
sequence. After the user confirms, the script asks for the administrator
password once (sudo -v) and then keeps the sudo
session alive in the background for the whole run, so it doesn't prompt
again at every step.
Procedure details
Removes the contents of system and user cache directories, and application log files.
sudo rm -rf /Library/Caches/*
rm -rf ~/Library/Caches/*
rm -rf ~/Library/Logs/*
Empties the temporary file directories used by the system and applications.
sudo rm -rf /private/var/tmp/*
sudo rm -rf /private/var/folders/*
Forces macOS to release inactive memory pages.
sudo purge
Flushes the DNS resolver cache and restarts the resolver service.
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
Lists and then deletes local snapshots created by Time Machine (restore points stored on the internal disk).
tmutil listlocalsnapshots /
sudo tmutil deletelocalsnapshots <snapshot>
If Homebrew is installed, updates formulae, upgrades installed packages, removes orphaned dependencies, and cleans the cache.
brew update
brew upgrade
brew autoremove
brew cleanup -s
Forces a full rebuild of the Spotlight search index for the main volume.
sudo mdutil -E /
Checks the integrity of the boot volume's file system.
diskutil verifyVolume /
Confirmation and completion
Before starting, the script displays a warning and asks for explicit
confirmation (o/n, French for yes/no). After the eight steps
complete, it recommends restarting the machine
(sudo shutdown -r now) to fully apply the effects of the
maintenance.