#!/bin/sh # Honesty Speed for Mac. Clears user and browser caches, empties the Trash, and flushes DNS. # Documents, photos, and saved passwords stay. DNS flush asks for your Mac password. set -u echo "Honesty Speed" echo "Cleaning caches. Documents, photos, and passwords stay." before=$(df -k / | awk 'NR==2 {print $4}') clean_dir() { label="$1" path="$2" if [ ! -d "$path" ]; then echo "$label: nothing to clean" return fi # Bytes before, best effort. bytes=$(du -sk "$path" 2>/dev/null | awk '{print $1}') find "$path" -mindepth 1 -maxdepth 1 -exec rm -rf {} + 2>/dev/null || true echo "$label: cleared (about ${bytes:-0} KB was in that folder)" } clean_dir "Safari cache" "$HOME/Library/Caches/com.apple.Safari" clean_dir "Chrome cache" "$HOME/Library/Caches/Google/Chrome" clean_dir "Edge cache" "$HOME/Library/Caches/Microsoft Edge" clean_dir "Firefox cache" "$HOME/Library/Caches/Firefox" rm -rf "$HOME/.Trash/"* 2>/dev/null || true echo "Trash: emptied" echo "Flushing DNS. macOS may ask for your password." sudo dscacheutil -flushcache 2>/dev/null || true sudo killall -HUP mDNSResponder 2>/dev/null || true echo "DNS: flush requested" after=$(df -k / | awk 'NR==2 {print $4}') freed=$((after - before)) if [ "$freed" -lt 0 ]; then freed=0; fi echo "About $((freed / 1024)) MB more free on the main disk." echo "Still slow? Call 1-888-711-9954 or open https://honestysupport.com/it"