mirror of
https://github.com/tw93/Mole.git
synced 2026-02-16 07:46:11 +00:00
Simplified words
This commit is contained in:
24
README.md
24
README.md
@@ -19,10 +19,10 @@
|
||||
## Features
|
||||
|
||||
1. All-in-one toolkit equal to CleanMyMac + AppCleaner + DaisyDisk + Sensei + iStat in one trusted binary.
|
||||
2. Deep cleanup digs through caches, temp files, browser leftovers, and junk to reclaim tens of gigabytes.
|
||||
3. Smart uninstall hunts down app bundles plus launch agents, preference panes, caches, logs, and debris.
|
||||
4. Disk insight + optimization reveal storage hogs, visualize folders, rebuild caches, trim swap, refresh services.
|
||||
5. Live status surfaces CPU, GPU, memory, disk, network, battery, and proxy telemetry so you spot bottlenecks.
|
||||
2. Deep cleanup finds and removes caches, temp files, browser leftovers, and junk to free up tens of gigabytes.
|
||||
3. Smart uninstall finds app bundles plus launch agents, settings, caches, logs, and leftover files.
|
||||
4. Disk insight + optimization show large files, display folders, rebuild caches, clean swap, refresh services.
|
||||
5. Live status shows CPU, GPU, memory, disk, network, battery, and proxy data so you can find problems.
|
||||
|
||||
## Quick Start
|
||||
|
||||
@@ -60,8 +60,8 @@ mo --version # Show installed version
|
||||
|
||||
## Tips
|
||||
|
||||
- Safety first, if your Mac is mission-critical, wait for Mole to mature before full cleanups.
|
||||
- Preview the cleanup by running `mo clean --dry-run` and reviewing the generated list.
|
||||
- Safety first, if your Mac is very important, wait for Mole to become stable before full cleanups.
|
||||
- Preview the cleanup by running `mo clean --dry-run` and reviewing the list.
|
||||
- Use `mo clean --whitelist` to manage protected caches.
|
||||
- Use `mo touchid` to approve sudo with Touch ID instead of typing your password.
|
||||
|
||||
@@ -117,11 +117,11 @@ $ mo optimize
|
||||
|
||||
System: 5/32 GB RAM | 333/460 GB Disk (72%) | Uptime 6d
|
||||
|
||||
✓ Rebuild system databases and flush caches
|
||||
✓ Rebuild system databases and clear caches
|
||||
✓ Reset network services
|
||||
✓ Refresh Finder and Dock
|
||||
✓ Clean diagnostic and crash logs
|
||||
✓ Purge swap files and restart dynamic pager
|
||||
✓ Remove swap files and restart dynamic pager
|
||||
✓ Rebuild launch services and spotlight index
|
||||
|
||||
====================================================================
|
||||
@@ -142,7 +142,7 @@ Analyze Disk ~/Documents | Total: 156.8GB
|
||||
4. ███░░░░░░░░░░░░░░░░ 10.8% | 📁 Documents 16.9GB
|
||||
5. ██░░░░░░░░░░░░░░░░░ 5.2% | 📄 backup_2023.zip 8.2GB
|
||||
|
||||
↑↓←→ Navigate | O Open | F Reveal | ⌫ Delete | L Large(24) | Q Quit
|
||||
↑↓←→ Navigate | O Open | F Show | ⌫ Delete | L Large(24) | Q Quit
|
||||
```
|
||||
|
||||
### Live System Status
|
||||
@@ -182,7 +182,7 @@ Launch Mole commands instantly from Raycast or Alfred:
|
||||
curl -fsSL https://raw.githubusercontent.com/tw93/Mole/main/scripts/setup-quick-launchers.sh | bash
|
||||
```
|
||||
|
||||
Adds 5 commands: `clean`, `uninstall`, `optimize`, `analyze`, `status`. Auto-detects your terminal or set `MO_LAUNCHER_APP=<name>` to override.
|
||||
Adds 5 commands: `clean`, `uninstall`, `optimize`, `analyze`, `status`. Finds your terminal automatically or set `MO_LAUNCHER_APP=<name>` to override.
|
||||
|
||||
Reload Raycast by running `Reload Script Directories`, or simply restarting Raycast.
|
||||
|
||||
@@ -190,8 +190,8 @@ Reload Raycast by running `Reload Script Directories`, or simply restarting Rayc
|
||||
|
||||
<a href="https://miaoyan.app/cats.html?name=Mole"><img src="https://miaoyan.app/assets/sponsors.svg" width="1000px" /></a>
|
||||
|
||||
- If Mole reclaimed storage for you, consider starring the repo or sharing it with friends needing a cleaner Mac.
|
||||
- Have ideas or fixes? Open an issue or PR and help shape Mole's roadmap together with the community.
|
||||
- If Mole freed storage for you, consider starring the repo or sharing it with friends needing a cleaner Mac.
|
||||
- Have ideas or fixes? Open an issue or PR and help shape Mole's future together with the community.
|
||||
- Love cats? Treat Tangyuan and Cola to canned food via <a href="https://miaoyan.app/cats.html?name=Mole" target="_blank">this link</a> and keep the mascots purring.
|
||||
|
||||
## License
|
||||
|
||||
14
bin/clean.sh
14
bin/clean.sh
@@ -221,7 +221,7 @@ start_section() {
|
||||
|
||||
end_section() {
|
||||
if [[ $TRACK_SECTION -eq 1 && $SECTION_ACTIVITY -eq 0 ]]; then
|
||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Nothing to tidy"
|
||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Nothing to clean"
|
||||
fi
|
||||
TRACK_SECTION=0
|
||||
}
|
||||
@@ -1240,7 +1240,7 @@ perform_cleanup() {
|
||||
end_section
|
||||
|
||||
# ===== 10. Virtualization tools =====
|
||||
start_section "Virtualization tools"
|
||||
start_section "Virtual machine tools"
|
||||
safe_clean ~/Library/Caches/com.vmware.fusion "VMware Fusion cache"
|
||||
safe_clean ~/Library/Caches/com.parallels.* "Parallels cache"
|
||||
safe_clean ~/VirtualBox\ VMs/.cache "VirtualBox cache"
|
||||
@@ -1279,7 +1279,7 @@ perform_cleanup() {
|
||||
# ===== 12. Orphaned app data cleanup =====
|
||||
# Only touch apps missing from scan + 60+ days inactive
|
||||
# Skip protected vendors, keep Preferences/Application Support
|
||||
start_section "Orphaned app data"
|
||||
start_section "Leftover app data"
|
||||
|
||||
local -r ORPHAN_AGE_THRESHOLD=60 # 60 days - good balance between safety and cleanup
|
||||
|
||||
@@ -1419,14 +1419,14 @@ perform_cleanup() {
|
||||
done
|
||||
|
||||
stop_inline_spinner
|
||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Found $orphaned_count orphaned app resources"
|
||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Found $orphaned_count leftover app files"
|
||||
|
||||
if [[ $orphaned_count -gt 0 ]]; then
|
||||
local orphaned_mb=$(echo "$total_orphaned_kb" | awk '{printf "%.1f", $1/1024}')
|
||||
echo " ${GREEN}${ICON_SUCCESS}${NC} Cleaned $orphaned_count orphaned items (~${orphaned_mb}MB)"
|
||||
echo " ${GREEN}${ICON_SUCCESS}${NC} Cleaned $orphaned_count leftover items (~${orphaned_mb}MB)"
|
||||
note_activity
|
||||
else
|
||||
echo " ${GREEN}${ICON_SUCCESS}${NC} No orphaned app data found"
|
||||
echo " ${GREEN}${ICON_SUCCESS}${NC} No leftover app data found"
|
||||
fi
|
||||
|
||||
rm -f "$installed_bundles"
|
||||
@@ -1435,7 +1435,7 @@ perform_cleanup() {
|
||||
|
||||
# ===== 13. Apple Silicon optimizations =====
|
||||
if [[ "$IS_M_SERIES" == "true" ]]; then
|
||||
start_section "Apple Silicon optimizations"
|
||||
start_section "Apple Silicon updates"
|
||||
safe_clean /Library/Apple/usr/share/rosetta/rosetta_update_bundle "Rosetta 2 cache"
|
||||
safe_clean ~/Library/Caches/com.apple.rosetta.update "Rosetta 2 user cache"
|
||||
safe_clean ~/Library/Caches/com.apple.amp.mediasevicesd "Apple Silicon media service cache"
|
||||
|
||||
@@ -174,18 +174,18 @@ execute_optimization() {
|
||||
timeout 10 /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user > /dev/null 2>&1 || true
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} LaunchServices database rebuilt"
|
||||
|
||||
echo -e "${BLUE}${ICON_ARROW}${NC} Flushing DNS cache..."
|
||||
echo -e "${BLUE}${ICON_ARROW}${NC} Clearing DNS cache..."
|
||||
if sudo dscacheutil -flushcache 2> /dev/null && sudo killall -HUP mDNSResponder 2> /dev/null; then
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} DNS cache flushed"
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} DNS cache cleared"
|
||||
else
|
||||
echo -e "${RED}${ICON_ERROR}${NC} Failed to flush DNS cache"
|
||||
echo -e "${RED}${ICON_ERROR}${NC} Failed to clear DNS cache"
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}${ICON_ARROW}${NC} Purging memory cache..."
|
||||
echo -e "${BLUE}${ICON_ARROW}${NC} Clearing memory cache..."
|
||||
if sudo purge 2> /dev/null; then
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} Memory cache purged"
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} Memory cache cleared"
|
||||
else
|
||||
echo -e "${RED}${ICON_ERROR}${NC} Failed to purge memory"
|
||||
echo -e "${RED}${ICON_ERROR}${NC} Failed to clear memory"
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}${ICON_ARROW}${NC} Rebuilding font cache..."
|
||||
@@ -215,7 +215,7 @@ execute_optimization() {
|
||||
cleanup_path "$target_path" "$label"
|
||||
done
|
||||
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} Finder and Safari caches refreshed"
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} Finder and Safari caches updated"
|
||||
;;
|
||||
|
||||
maintenance_scripts)
|
||||
@@ -231,9 +231,9 @@ execute_optimization() {
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}${ICON_ARROW}${NC} Rotating system logs..."
|
||||
echo -e "${BLUE}${ICON_ARROW}${NC} Moving old system logs..."
|
||||
if sudo newsyslog > /dev/null 2>&1; then
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} Log rotation complete"
|
||||
echo -e "${GREEN}${ICON_SUCCESS}${NC} Log move complete"
|
||||
else
|
||||
echo -e "${YELLOW}!${NC} newsyslog reported an issue"
|
||||
fi
|
||||
@@ -295,7 +295,7 @@ execute_optimization() {
|
||||
sudo rm -f /Library/Preferences/com.apple.Bluetooth.plist 2> /dev/null || true
|
||||
echo -e " ${GREEN}${ICON_SUCCESS}${NC} Bluetooth caches refreshed"
|
||||
|
||||
echo -e "${BLUE}${ICON_ARROW}${NC} Resetting Wi-Fi configuration..."
|
||||
echo -e "${BLUE}${ICON_ARROW}${NC} Resetting Wi-Fi settings..."
|
||||
local sysconfig="/Library/Preferences/SystemConfiguration"
|
||||
if [[ -d "$sysconfig" ]]; then
|
||||
sudo cp "$sysconfig"/com.apple.airport.preferences.plist "$sysconfig"/com.apple.airport.preferences.plist.bak 2> /dev/null || true
|
||||
@@ -325,7 +325,7 @@ execute_optimization() {
|
||||
;;
|
||||
|
||||
saved_state_cleanup)
|
||||
echo -e "${BLUE}${ICON_ARROW}${NC} Purging saved application states..."
|
||||
echo -e "${BLUE}${ICON_ARROW}${NC} Removing saved application states..."
|
||||
local state_dir="$HOME/Library/Saved Application State"
|
||||
cleanup_path "$state_dir" "Saved Application State"
|
||||
ensure_directory "$state_dir"
|
||||
|
||||
@@ -181,7 +181,7 @@ func newModel(path string, isOverview bool) model {
|
||||
m.offset = 0
|
||||
if nextPendingOverviewIndex(m.entries) >= 0 {
|
||||
m.overviewScanning = true
|
||||
m.status = "Estimating system roots..."
|
||||
m.status = "Checking system folders..."
|
||||
} else {
|
||||
m.status = "Ready"
|
||||
}
|
||||
@@ -669,7 +669,7 @@ func (m model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
defer cancel()
|
||||
_ = exec.CommandContext(ctx, "open", "-R", path).Run()
|
||||
}(selected.Path)
|
||||
m.status = fmt.Sprintf("Revealing %s in Finder...", selected.Name)
|
||||
m.status = fmt.Sprintf("Showing %s in Finder...", selected.Name)
|
||||
}
|
||||
} else if len(m.entries) > 0 {
|
||||
selected := m.entries[m.selected]
|
||||
@@ -678,7 +678,7 @@ func (m model) updateKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
defer cancel()
|
||||
_ = exec.CommandContext(ctx, "open", "-R", path).Run()
|
||||
}(selected.Path)
|
||||
m.status = fmt.Sprintf("Revealing %s in Finder...", selected.Name)
|
||||
m.status = fmt.Sprintf("Showing %s in Finder...", selected.Name)
|
||||
}
|
||||
case "delete", "backspace":
|
||||
// Delete selected file or directory
|
||||
@@ -1078,15 +1078,15 @@ func (m model) View() string {
|
||||
|
||||
fmt.Fprintln(&b)
|
||||
if m.inOverviewMode() {
|
||||
fmt.Fprintf(&b, "%s↑↓→ | Enter | O Open | F Reveal | Q Quit%s\n", colorGray, colorReset)
|
||||
fmt.Fprintf(&b, "%s↑↓→ | Enter | O Open | F Show | Q Quit%s\n", colorGray, colorReset)
|
||||
} else if m.showLargeFiles {
|
||||
fmt.Fprintf(&b, "%s↑↓ | O Open | F Reveal | ⌫ Delete | L Back | Q Quit%s\n", colorGray, colorReset)
|
||||
fmt.Fprintf(&b, "%s↑↓ | O Open | F Show | ⌫ Delete | L Back | Q Quit%s\n", colorGray, colorReset)
|
||||
} else {
|
||||
largeFileCount := len(m.largeFiles)
|
||||
if largeFileCount > 0 {
|
||||
fmt.Fprintf(&b, "%s↑↓←→ | Enter | O Open | F Reveal | ⌫ Delete | L Large(%d) | Q Quit%s\n", colorGray, largeFileCount, colorReset)
|
||||
fmt.Fprintf(&b, "%s↑↓←→ | Enter | O Open | F Show | ⌫ Delete | L Large(%d) | Q Quit%s\n", colorGray, largeFileCount, colorReset)
|
||||
} else {
|
||||
fmt.Fprintf(&b, "%s↑↓←→ | Enter | O Open | F Reveal | ⌫ Delete | Q Quit%s\n", colorGray, colorReset)
|
||||
fmt.Fprintf(&b, "%s↑↓←→ | Enter | O Open | F Show | ⌫ Delete | Q Quit%s\n", colorGray, colorReset)
|
||||
}
|
||||
}
|
||||
if m.deleteConfirm && m.deleteTarget != nil {
|
||||
|
||||
Reference in New Issue
Block a user